home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / C / Games / Xconq 7.0d16 / doc / design.texi next >
Encoding:
Text File  |  1993-12-20  |  115.7 KB  |  2,734 lines  |  [TEXT/MPS ]

  1. @chapter Designing Games with Xconq
  2.  
  3. In this chapter, you'll learn how to design new kinds of games with
  4. @i{Xconq}.  @i{Xconq} has been designed to support the use of a variety
  5. of techniques to design, construct, and test your game idea.
  6. These techniques range from text file editing to online painting,
  7. and you will likely find a combination of techniques to be most
  8. effective.
  9.  
  10. As the person customizing @i{Xconq},
  11. you will be called the @dfn{designer}.
  12. This term also indicates the primary activity, which will
  13. be to Design The Game.  The capabilities described below are merely tools;
  14. it is up to you the designer to exercise discretion and
  15. judgement in using them.
  16. Some principles of game design will be discussed in at the
  17. end of this chapter.
  18.  
  19. You design games using @i{Xconq}'s Game Design Language (GDL).
  20. GDL is @i{Xconq}'s common language for defining all parts of a game,
  21. from the entry in the menu that players select games from,
  22. down to the last tiny detail of a saved game.
  23. GDL resembles Lisp, although (at the present time) it is not a procedural
  24. language; there are no functions or even any control constructs.
  25. Instead, the contents of a file guide the creation or modification of
  26. @i{Xconq} objects representing types, tables, units, and so forth.
  27. While a game is being played, @i{Xconq} uses this data to decide
  28. what to do and what to allow players to do.
  29.  
  30. (People often have trouble with parentheses in Lisp, but if you follow
  31. the same kinds of indentation rules that you always use in
  32. C or Pascal, then you will encounter no additional trouble.
  33. Also, many editors such as Emacs are intelligent enough to indicate
  34. when parentheses match, and automatically do proper indentation.)
  35.  
  36. In this chapter, ``you'' always means means you the designer,
  37. and players will be referred to as ``players'' or ``users''.
  38. The distinction is important; as the game designer, you will encounter and
  39. deal with many technical issues, but if you master those issues,
  40. your players will see only a fun game to play.
  41.  
  42. This chapter is merely an overview of game design machinery; for precise
  43. definitions, see Chapter 4.
  44. The glossary defines all the technical terms.
  45.  
  46. A final caveat before plunging in: @i{Xconq} is an experiment in the design and
  47. construction of configurable games.  This means I have had very little
  48. prior art on which to build, and there are lots of odd corners that
  49. have never been tested or even thought about.  In this spirit, I would like
  50. to hear about weird cases, and ideas for how to handle them.
  51.  
  52. @node A Tutorial Example,,,
  53.  
  54. @section A Tutorial Example
  55.  
  56. Before delving into the depths of the language,
  57. let's look at an example.
  58. Suppose you just finished watching a Godzilla movie,
  59. complete with roaring monsters, panic-stricken mobs,
  60. fire trucks putting out flames, and so forth,
  61. and were inspired to design a game around this theme.
  62.  
  63. @subsection Basic Definitions
  64.  
  65. Start by opening up a file, calling it something like @code{g-vs-t.g},
  66. or as appropriate for your machine, and then type this into it:
  67. @example
  68. (game-module "g-vs-t"
  69.   (title "Godzilla vs Tokyo")
  70.   (blurb "Godzilla stomps on Tokyo")
  71. )
  72. @end example
  73.  
  74. This is a GDL @dfn{form}.
  75. It declares the name of the game to be @code{"g-vs-t"},
  76. gives it a name that prospective players can see in menus,
  77. plus a short description or @dfn{blurb}.
  78. The blurb should tell prospective players what the game is all
  79. about, perhaps whether it is simple or complex, or whether
  80. it is one-player or multi-player.
  81.  
  82. The @code{game-module} form is optional but recommended;
  83. some interfaces use it to add the game to a list of games
  84. that players can choose from.
  85.  
  86. The general syntax of @code{game-module} form is similar to that
  87. used by nearly all GDL forms;
  88. it amounts to a definition of an ``object'' (such as a game module or a
  89. unit type) with @dfn{properties} (such as name, description, speed, etc).
  90. Some properties are required, and appear at fixed positions,
  91. while others are optional and can be specified in any order,
  92. so they are introduced by name.  The general format, then, looks like
  93. @example
  94. (<object> ... <required properties> ...
  95.   ...
  96.   (<property name> <property value>)
  97.   ...
  98.   )
  99. @end example
  100. There are very few exceptions to this general syntax rule.
  101.  
  102. Now the first thing you'll need is a monster.
  103. In @i{Xconq}, each unit has a type, and you define the characteristics
  104. attached to the type.
  105. @example
  106. (unit-type monster)
  107. @end example
  108. This declares a new unit type named @code{monster},
  109. but says nothing else about it.
  110. Let's use this more interesting form instead:
  111. @example
  112. (unit-type monster
  113.   (image-name "monster")
  114.   (start-with 1)
  115. )
  116. @end example
  117. This shows the usual way of describing the monster.
  118. In this case, @code{image-name} is a predefined @dfn{property}
  119. that specifies the name of the icon that will be used to display
  120. a monster unit.
  121. The property @code{start-with} says that each side should start out
  122. with one monster.  This isn't quite right, because there should only
  123. be one side with a monster, and this will give @i{each} side a monster
  124. to start out with, but we'll see how to fix that later on.
  125.  
  126. We also need at least one type of terrain for the world:
  127.  
  128. @example
  129. (terrain-type street (color "gray"))
  130. @end example
  131.  
  132. Streets are to be gray when displayed in color, and get nothing if they
  133. are being displayed on a monochrome screen.
  134.  
  135. These two forms are actually sufficient by themselves to start up a game.
  136. (Go ahead and try it.)
  137. However, you'll notice that the game is not very interesting.
  138. Although each player gets a monster, and an area consisting of all-street
  139. terrain is displayed,
  140. nobody can actually @emph{do} anything,
  141. since the defaults basically turn off all possible actions.
  142.  
  143. @subsection Movement
  144.  
  145. Well, that was dull.
  146. Let's give the monsters the ability to move by putting this form into
  147. the file:
  148. @example
  149. (add monster acp-per-turn 4)
  150. @end example
  151. The @code{add} form is very useful; it says to modify the existing
  152. type named @code{monster}, setting the property @code{acp-per-turn}
  153. to 4, overwriting whatever value might have been there previously.
  154. The @code{acp-per-turn} property gives the monster the ability to act,
  155. up to 4 actions in each turn.
  156. By default, the ability to act is 1-1 with the speed of the unit,
  157. so the monster can also move into a new cell 4 times each turn.
  158. If you run the game now, you will find that your monster can now get
  159. around just fine.
  160. Why 4?
  161. Actually, at this point the exact value doesn't matter,
  162. since nothing else is happening.  If the speed is 1, then the turns
  163. go faster; if the speed is 10, then they go slower and more action
  164. happens in a single turn.
  165. In a complete design however, the exact speed of each unit can be
  166. a critical design parameter, and for this game, I figured that a speed
  167. of 4 allowed a monster to cover several cells in a hurry while not
  168. being able to get too far.
  169. Also, I'm planning to make panic-stricken mobs have a speed of 1,
  170. which is the slowest possible.
  171. Making actions 1-1 with speed is usually the right thing to do,
  172. since then a player will get to move 4 times each turn
  173. (later on we will see reasons for other combinations of values).
  174.  
  175. The @code{add} form works on most types of objects.  It has the
  176. general form
  177. @example
  178. (add <type(s)/object(s)> <property name> <value(s)>)
  179. @end example
  180. The type or object may be a list, in which the value is either given
  181. to all members of the list, or if it is a list itself, then the list
  182. of values is matched up with the list of types.
  183.  
  184. @subsection Buildings and Rubble Piles
  185.  
  186. To give the monster something to do besides walk around, add buildings:
  187. @example
  188. (unit-type building (image-name "city20"))
  189.  
  190. (table independent-density (building street 500))
  191. @end example
  192. The @code{building} type uses an icon that is normally used for a
  193. 20th-century city, but it has the right look.
  194. The @code{independent-density} table says how many buildings will appear
  195. in the world.  The definition of a table consists of three-part lists;
  196. the two indexes into the table, and a value.  In this case, one index
  197. is a unit type @code{building}, the other is a terrain type @code{street},
  198. and the value is @code{500}, which means that we will get about 500
  199. buildings placed on a 100x100 world (look up the definition of this table
  200. in the index).
  201. You need some for testing purposes, otherwise you won't see any when you
  202. start up the game.
  203. In general,
  204. @i{Xconq} policy is not to do anything unless you've turned it on first,
  205. and then to give you ``reasonable'' defaults once things are turned on.
  206.  
  207. We're going to let buildings default to not being able to do anything,
  208. since that seems like a reasonable behavior for buildings
  209. (although Baba Yaga's hut might be fun...).
  210.  
  211. By default, buildings act strictly as obstacles; monsters cannot touch
  212. them, push them out of the way, or walk over them.
  213. In real(?) life of course, monsters squash buildings,
  214. so we have to define a sort of combat.
  215. @example
  216. (table hit-chance
  217.   (monster building 90)
  218.   (building monster 10)
  219. )
  220.  
  221. (table damage
  222.   (monster building 1)
  223.   (building monster 3)
  224. )
  225.  
  226. (add (monster building) hp-max (100 3))
  227. @end example
  228. Note that the @code{add} form allows lists in addition to single
  229. types and values, in which case it just matches up the two lists.
  230. The @code{add} tries to be smart about this sort of thing; see its
  231. official definition for all the possibilities.
  232. The sum total of these defns basically say that a monster has a 90%
  233. chance of hitting a building and causing 1 hp of damage;
  234. three such hits destroy the building.
  235. A monster's knuckle might occasionally be skinned doing this;
  236. a 10% chance of 3/100 hp damage is not usually dangerous,
  237. and feels a little more realistic without complicating things
  238. for the player.
  239.  
  240. Now you can start up a game, and have your monster go over and
  241. bash on buildings.  Simulated wanton destruction!
  242.  
  243. By default, a destroyed building vanishes, leaving only empty
  244. terrain behind.  If you want to leave an obstacle, define a new
  245. unit type and let the destroyed building turn into it:
  246. @example
  247. (unit-type rubble-pile (image-name "???"))
  248.  
  249. (add building wrecked-type rubble-pile)
  250. @end example
  251. In practice, you have to be careful to define the behavior of rubble
  252. piles.  What happens when a monster hits a rubble pile?  Can the rubble
  253. pile be cleared away?  Does it affect movement?
  254. Try these things in a game now and see what happens;
  255. sometimes the behavior will be sensible, and sometimes not.
  256.  
  257. For instance, you will observe that the default behavior is for
  258. the rubble pile to be an impenetrable obstacle!  The monster can't
  259. hit it, and can't stand on it, and in fact can't do anything at all.
  260. OK, let's fix it.  Monsters are agile enough to climb over all sorts
  261. of things, so the right thing is to let the monster co-occupy the
  262. cell that the rubble pile is in.  The default is to only allow one
  263. unit in a cell, but this can be changed:
  264. @example
  265. (table unit-size-in-terrain (rubble-pile t* 0))
  266. @end example
  267. This says that while all other units have a size of 1, rubble piles
  268. only have a size of 0.  By default, each terrain type has a capacity
  269. of 1, so this allows one unit and any number of rubble piles to stack
  270. together in a cell.
  271.  
  272. If you try this out, you'll find that the monster can now cross over
  273. rubble piles, but still has to bash buildings in order to get them
  274. out of the way.
  275.  
  276. Incidentally, it can cause problems to set a unit size to zero,
  277. because it allows infinite stacking.  Since buildings and rubble
  278. piles don't move, we can never get gigantic stacks of units, but
  279. @i{Xconq} will happily let hundreds of units share the same cell,
  280. which causes no end of headaches for players confronted with overloaded
  281. displays.  A game is more playable if it has at least some limits
  282. on stacking.  For instance, this limits stacking of rubble piles,
  283. and also keeps the monster out of really full-up places:
  284. @example
  285. (table unit-size-in-terrain (u* t* 1))
  286.  
  287. (add t* unit-capacity 16)
  288. @end example
  289.  
  290. @subsection Human Units
  291.  
  292. Now you've got an ``interactive experience'' but no game;
  293. there's no challenge or goal.
  294. You could maybe make a two-or-more-player game where the players
  295. race to see who can flatten the mostest the fastest,
  296. but that's still not too interesting to anyone past the age of 5.
  297. Instead, we need to make some units for the people bravely
  298. (or not so bravely) resisting the monster's depredations:
  299. @example
  300. (unit-type mob (name "panic-stricken mob") (image-name "mob"))
  301. (unit-type |fire truck| (image-name "firetruck"))
  302. (unit-type |national guard| (image-name "soldiers"))
  303. @end example
  304. Note that a type's name may have an embedded space, but then you have to
  305. put vertical bars around the whole symbol (a la Common Lisp).
  306. Things are starting to get complicated,
  307. so let's define some shorter synonyms:
  308. @example
  309. (define f |fire truck|)
  310. (define g |national guard|)
  311.  
  312. (define humans (mob f g))
  313. @end example
  314. You can use the newly defined symbols @code{f} and @code{g}
  315. anywhere in place of the original type names.
  316. The symbol @code{humans} is a list of types, and will be useful
  317. in filling several propertys at once.
  318.  
  319. As with monsters, all these new units should be able to move:
  320. @example
  321. (add humans acp-per-turn (1 6 2))
  322. @end example
  323. The speeds here are adjusted so that monsters can chase and run down
  324. (and presumably trample to smithereens) mobs and guards,
  325. but fire trucks will be able to race away.
  326.  
  327. Also note the use of a three-element list that matches up with the
  328. three elements in the @code{humans} list.  This is a very useful
  329. features of GDL, and used heavily.  It can also be a problem,
  330. since if you add or remove elements from the list @code{humans},
  331. every list that it is supposed to match up with also has to change.
  332. Fortunately, @i{Xconq} will tell you if any lists do not match up
  333. because they are of different lengths.
  334.  
  335. We still need to define some interaction, since monsters and humans
  336. can make faces at each other, and get in each other's way, but otherwise
  337. cannot interact.
  338. @example
  339. (add table hit-chance
  340.   (monster humans 50)
  341.   (humans monster (0 10 70))
  342.   )
  343. @end example
  344. This time we have to say ``add table'' because we've already defined
  345. the @code{hit-chance} table and now just want to augment it.
  346.  
  347. As with the addition of properties, we can use a list in place of
  348. a single type.
  349.  
  350. Last but not least, we need a scorekeeper to say how winning and losing
  351. will happen.  This is a simple(-minded?) game, so a standard type will
  352. be sufficient:
  353. @example
  354. (scorekeeper (do last-side-wins))
  355. @end example
  356. The @code{do} property of a scorekeeper may include some rather elaborate
  357. tests, but all we want to is to say that the last side left standing
  358. should be the winner, and the symbol @code{last-side-wins} does just that.
  359.  
  360. There might be a bit of a problem with this in practice, since in order
  361. to win, the monster has to stomp on all the humans, including fire trucks.
  362. But fire trucks can always outrun the monster, and cannot attack it
  363. directly either, which leads to a stalemate.
  364. You can fix this by zeroing the point value of fire trucks:
  365. @example
  366. (add f point-value 0)
  367. @end example
  368. Now, when all the mobs and guards have been stomped, the monster wins
  369. automatically, no matter how many fire trucks are left.
  370.  
  371. @subsection The Scenario
  372.  
  373. As it now stands, your game design requires @i{Xconq}
  374. to generate all kinds of stuff randomly,
  375. such as the initial set of units, terrain, and so forth.
  376. However, we @emph{are} doing a monster movie, so random combinations
  377. of monsters and people and terrain don't usually make sense.
  378. Instead of trying to define a ``reasonable'' random setup,
  379. we should define a scenario, either by starting a random
  380. game, modifying, and saving it, or by text editing.
  381. Since online scenario creation is hard to describe in the manual,
  382. let's do it with GDL instead.
  383.  
  384. To define a scenario, we generally need three things:
  385. sides, units, and terrain.
  386. Now the basic monster movie idea puts one monster up against
  387. a bunch of people acting together, so that suggests two sides:
  388.  
  389. @example
  390. (side 1)
  391.  
  392. (side 2 (name "Tokyo") (adjective "Japanese"))
  393. @end example
  394.  
  395. The @code{1} and @code{2} identify the two sides uniquely,
  396. since we'll have to match units up with them in a moment.
  397. The side that plays the monster is really a convenience;
  398. players should just be aware of the one monster unit,
  399. so we don't need any sort of names.
  400. The other side has many units, which should be qualified
  401. as @code{"Japanese"}, and the side as a whole really represents
  402. the city of Tokyo, so use that for the side's name.
  403.  
  404. Now for the units:
  405.  
  406. @example
  407. (unit monster (s 1) (n "Godzilla"))
  408.  
  409. (unit firetruck (s 2))
  410. (unit firetruck (s 2))
  411.  
  412. (building 9 10 2)
  413.  
  414. (define b building)  ; abbreviate for compactness' sake
  415.  
  416. (b 10 10 2)
  417. (b 11 10 2 (n "K-Mart"))
  418. (b 12 12 2 (n "Tokyo Hilton"))
  419. (b 13 12 2 (n "Hideyoshi's Rice Farm"))
  420. (b 14 12 2 (n "Apple Japan"))
  421. ;; ... need lots of buildings ...
  422. @end example
  423.  
  424. This example shows two syntaxes for defining units:
  425. the first is introduced by the symbol @code{unit} and
  426. requires only a unit type (or an id, see the definition in xxx),
  427. while the second is introduced by
  428. the unit type name itself and requires a position and side.
  429. The second form is more compact and thus suitable for setting up large
  430. numbers of units, while the first form is more flexible, and can be used
  431. to modify an already-created unit.  In both cases, the required data
  432. may be followed by optional properties in the usual way.
  433.  
  434. Also, since the word ``building'' is a little longwinded,
  435. I defined the symbol ``b'' to evaluate to ``building''.
  436. GDL has very few predefined variables,
  437. so you can use almost anything, including weird stuff like
  438. ``&'' and ``=''.
  439. Property names like @code{s} and @code{n} are NOT predefined
  440. variables, so you can use those too if you like.
  441.  
  442. At this point, you should have a basic game scenario,
  443. with one player being Godzilla, and the other trying to
  444. keep it from running amuck and flattening all of Tokyo.
  445. Have fun!
  446.  
  447. You can enhance this scenario in all kinds of ways,
  448. depending on how ambitious you want to get.
  449. Given the basic silliness of the premise, though,
  450. it would be more worthwhile to enhance the silliness
  451. and speed up the pace, rather than to add features and details.
  452. For instance, name the buildings after all the laughingstock
  453. places you know of in your own town.
  454.  
  455. To see where you could go with this, look at the library's @code{monster}
  456. game and its @code{tokyo} scenario, which include fires, different kinds
  457. of terrain, and other goodies.
  458.  
  459. @section Types
  460.  
  461. Types are the foundation of all @i{Xconq} game designs.
  462. Types are like classes in object-oriented programming but simpler;
  463. each set of types is fixed and used only in a particular way by @i{Xconq}.
  464. A game design defines types of units, materials, and terrain.
  465. Only materials are optional; every game design must define at
  466. least one unit type and one terrain type.
  467.  
  468. Types in GDL are simple compared to most other languages.
  469. There is no inheritance, no subtyping, no coercions or conversions.
  470. This is not a real limitation, since game designs are usually too
  471. small to make effective use of any sort of inheritance.
  472. Also, game design is an exacting activity;
  473. inheritance is often difficult to control satisfactorily.
  474. You can use lists of types to simulate inheritance as necessary;
  475. this is actually more flexible, because you can have any
  476. number of lists with any set of types in each.
  477. It may not seem as efficient, but GDL is only used during
  478. startup, and is almost entirely array- and struct-based during
  479. the game.  (A few places, such as scorekeeping, examine GDL forms
  480. during play.)
  481.  
  482. Types are defined one at a time in the game module file.
  483. Each type gets an index from 0 on up, in order of the type's
  484. appearance in the file.  Although this is not normally visible
  485. to you or to the player, some error messages and other places
  486. will make reference to raw type indices.
  487. Each category of type - unit, material, and terrain
  488. is indexed individually.
  489.  
  490. @subsection Unit Types
  491.  
  492. Unit types define what the players get to play with.
  493. Unit types can include almost anything; people, buildings, airplanes,
  494. monsters, arrows, boulders, you name it.
  495.  
  496. The basic form of a unit type definition is so:
  497. @example
  498. (unit-type @var{type-name} (@var{property-name} @var{property-value}) @dots{})
  499. @end example
  500. The appearance of this form in a file means you are adding a new and
  501. distinct type, which has no relation to any other types defined before
  502. and after this one.  The @var{type-name} must be a unique symbol,
  503. such as @code{building} or @code{|fire truck|}. (Note that you can set
  504. things up so that players never see the @var{type-name} anywhere,
  505. so don't worry if your preferred name conflicts with something else,
  506. just choose another name.)
  507. The @var{property-name} and @var{property-value} pairs are entirely optional.
  508. They can always be defined or changed later in the file.
  509. There is little advantage one way or another.
  510.  
  511. This particular syntax - keyword followed by name or other identifier
  512. followed by property/value pairs - will be used for most GDL definitions.
  513.  
  514. The number of unit types is limited.  The exact limit depends on the
  515. implementation, but is guaranteed to be at least 127.
  516. This is a huge number of types
  517. in practice; the only situations where this might be needed would be
  518. a fantasy-type game with many types of items and monsters.
  519. For empire-building games, 8-16 unit types is far more reasonable.
  520. Keep in mind that with lots of types, players have more to keep track of,
  521. internal data structures will be larger and take longer to work with,
  522. and designing the game will take more time and energy.
  523. Consider also that @i{Xconq} gives you a lot of properties
  524. that you can set individually for each unit type,
  525. so that when other game systems might require a distinct types, @i{Xconq}
  526. lets you use the same type with different propertys.
  527. For instance, in a fantasy
  528. game you wouldn't need to define ``young dragons'' and ``old dragons'' as
  529. distinct types, instead you can vary the hit points or experience of
  530. a generic ``dragon'' type.
  531.  
  532. @subsection Terrain Types
  533.  
  534. Each cell in the world has a terrain type.  This type should be thought
  535. of as the predominant contents of the cell, whether it be open ground,
  536. forest, city streets, or the vacuum of deep space.
  537. The type can be anything
  538. you want, and should be adapted to fit the game you're designing.
  539. Sure, the real world has swamps, but if you're designing a game set
  540. in the Sahara, don't bother defining a swamp terrain type.
  541. Also, the type doesn't carry any preconceptions about elevation
  542. or climate, so you can have swamps at 20,000 feet just as easily
  543. as at sea level.
  544.  
  545. The limit on the number of terrain types is large
  546. (up to about 127, depending on the implementation),
  547. but in practice, 6-10 types offer variety without being confusing.
  548. Ideally, several of those types will be uncommon in the world,
  549. so that map displays will consist mostly of 3-4 types of terrain.
  550.  
  551. Some game designs involve entities that are very large and do not move around.
  552. Such entities could plausibly be represented either as non-moving units or as a
  553. distinct terrain type.  To make the right choice, you need to consider the
  554. special characteristics you want to implement.  Terrain cannot (usually)
  555. be changed during the game, nor can it be moved, but units can be damaged
  556. or belong to different sides.  A realistic example of this choice occurs
  557. in the monster game - should a destroyed building become a ``rubble-pile''
  558. unit or should the building stand on rubble-pile terrain and vanish when
  559. it is destroyed?  Both choices are plausible; if the rubble-pile is a unit,
  560. then the original building is then on top of an empty city block, and after
  561. the building is destroyed, the rubble-pile unit can itself be cleaned off,
  562. exposing the empty city block again.  However, you have to decide whether
  563. the rubble-pile unit belongs to a side, how it interacts with other units,
  564. and so forth.  Rubble-pile terrain is simpler, but the players then get
  565. descriptions of brand-news buildings sitting in the midst of rubble-piles,
  566. which is confusing.  This is a case where there is no ``right'' answer.
  567.  
  568. @subsection Material Types
  569.  
  570. Material types are the simplest to define.  They have only a few properties
  571. of their own; most of the time they just index tables along with the
  572. other types.
  573. Materials do not act on their own in any way; instead, players
  574. manipulate materials as part of doing other actions.
  575. For instance, you can specify that movement, combat, and even a
  576. unit's very survival depends on having a supply of some material,
  577. or that some material is ammo and consumed gradually when fighting.
  578.  
  579. The use of materials is pretty much up to you.  You don't have to
  580. define any material types at all,
  581. and game designs with materials are usually more complicated.
  582. However, the increase in realism is often worth it;
  583. with materials you can limit player activity
  584. and/or make some actions more ``expensive'' than others.
  585.  
  586. As with the other types, you can define up to about 127 material types,
  587. but that would be enough to model the entire global economy
  588. accurately! (and take all week to compute a single turn...)
  589. 1-3 types is reasonable.
  590.  
  591. @subsection Hints
  592.  
  593. It is tempting to try to define independent sets of types,
  594. each in a separate module, and glue them together somehow.
  595. However, this doesn't work well in practice, because in a game,
  596. the types interact in unexpected ways.
  597. Suppose, for example, that you define a set of airplane types that
  598. you want to be generic enough to use with several different games.
  599. The assessment of those types may vary drastically from game to game;
  600. in one, airplanes are 100 times faster than any other sort of unit,
  601. so that moving airplanes takes up 99% of game play, while in another,
  602. the same set of airplane types are too weak to be of any interest to
  603. players.
  604.  
  605. There is a standard set of terrain types called @code{"stdterr"}.
  606. This set has a mix of the types found most useful for ``Empire-type'' games,
  607. and Earth-like percentages for random world generation.
  608.  
  609. @section Setting up a Game
  610.  
  611. You have a spectrum of options for how @i{Xconq} will set up a game
  612. based on your design.  At the one end, you can build a scenario that
  613. specifies everything exactly, down to the last unit.  Lest you think
  614. this is too restrictive to be interesting, consider that this is
  615. how chess works...
  616. At the other end of the spectrum,
  617. you can let @i{Xconq} manufacture everything,
  618. starting only with a handful of numbers that you supply.
  619.  
  620. The next several sections describe the alternatives available for
  621. game setup.  It is important to understand what is possible,
  622. because in general the character of an @i{Xconq} game will depend
  623. strongly on the initial setup, and players will be very angry
  624. (with you!) if they discover, several hours into a hard-fought game,
  625. that they've been given a grossly unfair starting position.
  626.  
  627. @section Designing the World
  628.  
  629. The @i{Xconq} world/area is a two-dimensional grid of fixed shape and size.
  630. You can make it represent part of a planet in space, by defining the
  631. circumference of the world,
  632. or just to make it be itself and not address the question
  633. of the surrounding context.  The appropriate choice depends on how much
  634. realism and complexity you need.  Most computer games don't bother with
  635. this detail; for instance, a game set in an underground dungeon doesn't
  636. usually need to compute daylight, weather, or seasons.  However, these
  637. same details are very important for games set outdoors.
  638.  
  639. @subsection World Shape and Size
  640.  
  641. Once you've decided whether the area is to be part of a planet or not,
  642. you can address the question of size and shape.
  643. You have two choices for shape: hexagon and cylinder.
  644. (See the players chapter for pictures of these.)
  645. The important thing for you as a a designer is that the cylinder
  646. wraps around, while the hexagon is bounded on all sides.
  647. One consequence is that games involving pursuit will be quite
  648. different; on a cylinder, the chase can go round and round forever,
  649. while on a hexagon, a fleeing unit could be cornered.
  650. Cylinders have a disadvantage in that there is no obvious ``starting place''
  651. for coordinates, scrolling, etc, so there is a navigation and orientation
  652. problem for players, especially if the world is randomly generated and not
  653. the familiar continents of the Earth.  In fact, players will often not
  654. even realize that a world is a cylinder and will assume that the edge
  655. of the display is the edge of the world!  To make a cylindrical area,
  656. set the circumference of the world equal
  657. to the width of the area.  Otherwise, the area will be handled as a hexagon.
  658.  
  659. You can choose either to set a fixed size using the @code{area} form,
  660. or allow players to set the actual size via the @code{world-size} variant,
  661. in which case you can define the allowable range of sizes.
  662.  
  663. Worlds need not be really large.  Larger worlds are harder for
  664. players to manage, they take longer to display, and can consume
  665. prodigious amounts of memory (since they are represented as arrays
  666. internally, for speed).  The ideal range of sizes depends primarily
  667. on the size and speed of units.  A 60x60 area in a game with units whose
  668. speed is 1 means that they will take 60 turns to cross, while units with
  669. a speed of 20 take only 3 turns, so they make the world ``feel smaller''.
  670. As another example, in the standard game,
  671. a 20x20 area allows player to come to grips quickly, but it also
  672. means that each player's cities will be within bomber range right
  673. from the outset, which has a drastic effect on strategy.
  674. For exploration-oriented games, larger worlds are more interesting.
  675.  
  676. @subsection World Terrain
  677.  
  678. The best technique is for designing the terrain of a world is
  679. to use the designer tools provided with @i{Xconq}.
  680. The details of these tools depend on the interface, but in general
  681. they resemble the tools found in paint programs.
  682. Some interfaces also give you the option of rescaling the map,
  683. so that you can fine-tune the size and positioning of the terrain.
  684.  
  685. Another technique is to write a program that translates data from another
  686. source (such as NASA satellite data) into @i{Xconq} format.
  687. If you do this and call it a hex world, then everything will appear
  688. to be tilting to the left.
  689. @c make into proper TeX eventually
  690. To fix this, map each cell (x, y) to (x - y / 2, y) before writing.
  691.  
  692. The crudest technique is to try to build terrain by using a text editor.
  693. The coordinate system is Cartesian oblique, with the y axis tilted to form
  694. a 60-degree angle with the x axis, so it can be difficult to relate
  695. typed-in characters to the final appearance.  Landforms in the file should
  696. appear to be leaning to the left, if they are to appear upright during play.
  697. However, sometimes text editing is necessary, for instance when you need
  698. to change every instance of a terrain type to something else.
  699. (Incidentally, some of
  700. the large real-world maps in the library
  701. were produced by coding all the terrain types from an atlas onto
  702. graph paper, typing them in, then fixing the tilt as described above.)
  703.  
  704. Incidentally, areas should have some distinguishing terrain
  705. around the edges; this prevents player confusion that sometimes
  706. happens when there is no other clue as to where the edge might be.
  707. However, this is not enforced by @i{Xconq}, and you can put
  708. whatever you like along the edges.
  709. Randomly generated worlds normally use the value of 
  710. the global variable @code{edge-terrain}.
  711.  
  712. @subsection Synthesizing World Terrain
  713.  
  714. The random way to get terrain for a world is to use one of several
  715. synthesis methods.
  716.  
  717. Totally random terrain is available via the synthesis method
  718. @code{make-random-terrain}.  This just randomly chooses a terrain
  719. type for each cell, using the weights in the @code{occurrence}
  720. property of each type.  An @code{occurrence} of 0 means that the
  721. type will never be placed anywhere.
  722. This method produces a sort of speckly-looking world,
  723. and is better for testing than for actual play.  Still, if you have
  724. two types @code{vacuum} and @code{solar-system}, then a form like
  725. @example
  726. (add (vacuum solar-system) occurrence (20 1))
  727. @end example
  728. will give you a nice starfield for a space game.
  729.  
  730. The fractal world method @code{make-fractal-percentile-terrain}
  731. descends from the most venerable part of @i{Xconq}
  732. (it was once a piece of Atari Basic code).  It uses a fractal algorithm
  733. along with percentile-based terrain classification to make realistic-looking
  734. worlds with terrain and elevations.
  735.  
  736. To use this method, you first specify how many, what size, and what height
  737. of blobs to splash onto the world,
  738. and how many times to average cells with their
  739. neighbors.  Then you specify the subdivision of all the possible altitudes
  740. and moisture levels into different kinds of terrain.
  741. For instance, desert in the standard terrain ranges from
  742. sea level (@code{alt-percentile-min} = 70%)
  743. to high elevations (@code{alt-percentile-max} = 93%) but only
  744. in the lowest percentiles of moisture (@code{wet-percentile-min} = 0%,
  745. @code{wet-percentile-max} = 20%).
  746. It is important that all percentiles be assigned
  747. to some terrain type, or the map generator will complain and subsitute
  748. terrain type 0 (the first-defined type); when designing
  749. terrain percentiles, it is helpful to make a chart with altitude percentiles
  750. 0-100 on one axis and moisture percentiles on the other.
  751. Note that overlapping on this chart is OK, and the terrain generator
  752. will pick the lowest-numbered terrain.
  753. Also note that you don't have to include every terrain type.
  754.  
  755. The alt numbers are also used to compute elevations
  756. for games that need them, but the wet numbers need not have anything to do
  757. with water at all; they could just as easily represent smog levels or
  758. vegetation densities.
  759. If you only want to use one of the two layers, just set the percentiles
  760. for the other to be 0 - 100 for all terrain types.
  761.  
  762. [should have an example]
  763.  
  764. [is this correct still?]
  765. The method @code{make-maze-terrain} produces a maze consisting
  766. of a mix of ``solid'', ``passageway'', and ``room'' terrain.
  767. It uses the @code{maze-room-density} and @code{maze-passage-density}
  768. properties of each terrain type to decide
  769. how much of each to use for rooms and passages.
  770. The method first does random terrain generation, using the
  771. @code{occurrence} property to decide how much of each terrain
  772. to put down (remember that @code{occurrence} defaults to 1 for
  773. all terrain types).
  774. Then it carves out rooms, and passageways between them.
  775. The passages and rooms are guaranteed to be completely connected.
  776.  
  777. The method @code{make-earth-like-terrain} attempts
  778. to model the natural processes and generate terrain as similar as possible
  779. to what is observed on Earth today.
  780.  
  781. You should note that at least one method for synthesizing terrain must be
  782. available, unless you can guarantee that terrain will be loaded from a
  783. file.  The following subsections describe optional additional synthesis
  784. methods that you can include.
  785.  
  786. @subsection Rivers
  787.  
  788. You can use the @code{make-rivers} method to add rivers to the world.
  789. Rivers are basically water features that depend on terrain elevations,
  790. so they won't be generated unless both a river terrain type (either
  791. border or connection) and elevation data is available.
  792. You get them by specifying a nonzero chance for some type of
  793. terrain to be the location of a headwater (@code{river-chance}).
  794.  
  795. @i{Xconq} doesn't have any intuition about the behavior of water;
  796. it will happily trace rivers all the the way down to the bottom of the sea.
  797. Use the @code{liquid} property to tell @code{make-rivers}
  798. what types that rivers cannot touch.
  799. The method still traces the river's course, and resume modifying
  800. terrain when possible, which means that the river can appear
  801. as both the inlet and outlet from a lake.
  802.  
  803. @subsection Roads
  804.  
  805. The @code{make-roads} method is a fairly generic method.
  806. It just picks pairs of units randomly and runs a road between them,
  807. attempting to share road segments and route through favorable terrain.
  808. Although simplistic, the results look pretty good.
  809.  
  810. You can make short bridges by tweaking the road density
  811. appropriately.  Just allow roads from land to water, and water to land,
  812. but not from water to water.
  813.  
  814. Note that this method is only useful after the units have been placed
  815. that the roads will connect.
  816.  
  817. @section Designing the Sides
  818.  
  819. Sides represent the players in a game.  They also serve as a repository
  820. of information shared by units, such as technology and knowledge
  821. of the world.
  822.  
  823. You should first decide how much about the sides will be predefined.
  824. If you're doing Eastern Front scenarios, it's very easy;
  825. you have Russians and Germans and that's it.  If you're doing a
  826. science-fiction empire-building free-for-all, you may not have to 
  827. specify anything more than a random side name generator.
  828.  
  829. @subsection Predefined Sides
  830.  
  831. For scenarios and similarly-restrictive games, the game design should create
  832. the sides directly, as in this example:
  833. @example
  834. (side (name "Germany") ... (colors "black,gray") ...)
  835.  
  836. (side (name "Russia") ... (colors "red") ...)
  837. @end example
  838.  
  839. Since the initialization machinery allows matching any player with
  840. any side, you can get away with being really vague.
  841. This will create four sides but not say anything about them:
  842. @example
  843. (side)
  844. (side)
  845. (side)
  846. (side)
  847. @end example
  848.  
  849. If you're going to have predefined units on each side, then you should
  850. add an id to each side:
  851. @example
  852. (side 1 (name "Germany") ... (colors "black,gray") ...)
  853.  
  854. (side 2 (name "Russia") ... (colors "red") ...)
  855. @end example
  856.  
  857. @subsection Side Library
  858.  
  859. If your game design does not predefine all the sides,
  860. you can define a @dfn{side library} using the @code{side-library} variable.
  861. Basically the library is a weighted list of collections of side properties,
  862. each formatted as a side definition.
  863. @i{Xconq} will use this library for any player that is allowed in the
  864. game but who does not have a side already, and select a side with
  865. a probability determined by the weights.
  866. Each item in the library will be used up to a limit that can be specified
  867. with each item;
  868. if the library has been exhausted before all the sides have been created,
  869. then the extra sides will just be assigned general defaults
  870. for their properties.
  871.  
  872. The side library here makes futuristic sides for players,
  873. making two of the sides most likely, but allowing others as well:
  874. @example
  875. (set side-library '(
  876.   (10 (name "Federation") (adjective "Federation") (class "fed"))
  877.   (10 (name "Klingon Empire") (noun "Klingon") (class "klingon"))
  878.   (5 (noun "Romulan") (class "romulan"))
  879.   ((noun "Ferengi") (class "fed"))
  880.   ((noun "Vulcan") (class "fed"))
  881.   ))
  882. @end example
  883. Note that if the game design limits certain unit types to certain sides,
  884. the choice of sides will be more than just a cosmetic issue.
  885.  
  886. @subsection Limits on Sides
  887.  
  888. So that you can put upper and lower bounds on the number of sides in your
  889. game, GDL includes the variables @code{sides-min} and @code{sides-max}.
  890. As you might expect, every game design must allow at least one side.
  891. The upper limit on sides depends on the implementation, but is at least 7.
  892. Large numbers of sides can make a player's life very complicated,
  893. not to mention consuming vast quantities of memory, so you should
  894. try to limit the number of sides as much as possible.
  895.  
  896. Another important limit is based on the notion of @dfn{side classes}.
  897. Each side can have a side class, and multiple sides can belong to the
  898. same class.
  899. For instance, sides named @code{"Hyperborean"} and @code{"Germanic"}
  900. could both have class @code{"barbarian"}.
  901. The value of side classes is that unit types have a property
  902. @code{possible-sides} that limits which side class(es)
  903. a type can belong to.  This is very important for any game
  904. in which different players should have fundamentally different
  905. sorts of units.  To continue the barbarians example, it is basically
  906. impossible for any barbarian side to have even one Roman legion,
  907. whether by construction, capture, or even surrender.
  908. So you can do something like
  909. @example
  910. (add legion possible-sides "roman")
  911.  
  912. ...
  913.  
  914. (side 1 (name "Rome") (class "roman"))
  915. (side 2 (name "Germania") (class "barbarian"))
  916. (side 3 (name "Hyperborea") (class "barbarian"))
  917. @end example
  918. and ensure that Roman legions are always Roman.
  919.  
  920. @subsection Hints
  921.  
  922. Note that a players tend to identify with the sides they're playing,
  923. so a game should allow for as much personalization as possible.
  924. On the other hand, some scenarios derive part of their flavor from
  925. predefinitions.  For instance, a scenario with sides named
  926. ``German'' and ``Russian'', with appropriate colors and emblems,
  927. doesn't have quite the same feel when players rename them to ``Subgenii''
  928. and ``Simpsons''.
  929.  
  930. A side can have a huge amount of state data, such as the current view.
  931. This rarely needs to be included in its entirety; synthesis methods
  932. will usually suffice to set view data correctly.
  933. Since total security is impossible with a predefined world,
  934. setting a side to have only a partial view won't necessarily
  935. be useful to keep players from knowing what that world really looks like.
  936.  
  937. @section Designing the Units
  938.  
  939. Once you've decided how to handle sides in your game,
  940. you can move on to the initial unit setup.
  941. Initial unit setup is very important, since it has a major
  942. bearing on how the rest of the game will go,
  943. and can be done in a number of different ways.
  944.  
  945. @subsection Predefined Units
  946.  
  947. GDL allows you to define everything about every starting unit in the game.
  948. This is a powerful approach, but requires much preparation.
  949. An advantage of predefined units is that there are no unpleasant surprises.
  950. For instance, suppose you designed a empire game with ships and cities,
  951. but a random setup leaves some players entirely landlocked.
  952. Not only will those players be @emph{very} unhappy, they might come
  953. looking for you @i{before} they've calmed down!
  954.  
  955. Asking for initial units is pretty easy, you can either type them into
  956. a file or create them directly, using the appropriate designer tool in
  957. a game.
  958. @example
  959. (city)
  960. (city 11 12 1)
  961. (city (n "Brigadoon"))
  962. (city (@@ 10 10) (n "New York"))
  963. (city (@@ 20 10) (n "London") (hp 22))
  964. @end example
  965. The only info that you absolutely have to supply is the unit's type.
  966. If the position is missing, the unit will be placed at a random location.
  967. If the side number/name is missing, the unit will be independent or on the first
  968. possible side.
  969.  
  970. While the type, position, and side of units is important, exact values of the
  971. other properties are rarely important for a scenario.  Also, a unit with
  972. fewer filled-in properties can be used in different games.
  973. For instance, a list of the present-day major cities worldwide
  974. really needs only name and location for each;
  975. the game design can fill in everything else.
  976. One way to do this would be to set up an appropriate
  977. @code{unit-defaults} just before including the module.
  978.  
  979. To make units start inside transports, you need to specify the @code{t#}
  980. property for the occupant, and have its value be the id number or name
  981. of some other unit.  Your players may get an error message if the
  982. occupant is not of an allowed type for the transport to hold.
  983.  
  984. @subsection Making Countries
  985.  
  986. Despite the advantages of predefining initial units,
  987. this doesn't help when you want variable groups of units
  988. to appear in a randomly-generated world.
  989. Instead, you should use the @code{make-countries} synthesis method.
  990. The basic idea is that the method picks a good location for each side's
  991. country, scatters an initial set of units around that location,
  992. then possibly grows the country outwards.
  993. You can do anything from small widely-separated countries to an
  994. interlocking nightmare resembling pre-Bismarck Germany.
  995. Because of this, and because of the requirement that this
  996. method generate random setups that are as fair as possible,
  997. you have a great many parameters to work with.
  998. These parameters should be tuned carefully - you will probably
  999. need to generate and study lots of initial setups, especially
  1000. if your parameters constrain the countries very tightly; the method
  1001. cannot backtrack to fix a poor combination of placements.
  1002.  
  1003. The first step in country generation is to select a location for
  1004. each side's country.  The location is a point that is the ``center''
  1005. of the country (the exact value will be unimportant to players,
  1006. and is not used outside this method).  The constraints are that the
  1007. center of each country is farther than @code{country-separation-min}
  1008. from the center of every other country, that the center is within
  1009. @code{country-separation-max} of at least one other country, and that the
  1010. given initial area of the country (as defined by @code{country-radius-min})
  1011. includes numbers of cells of each terrain type bounded by
  1012. @code{country-terrain-min} and @code{country-terrain-max}.
  1013.  
  1014. The reason for the separation constraints is that having countries
  1015. too close together or too far apart can create serious problems.
  1016. Consider the poor soul who gets tightly sandwiched between two enemies,
  1017. thus becoming lunchmeat, ha ha, or the not-quite-so-poor-but-still-unlucky
  1018. player who ends up on the wrong side of a very large world.  (Keep in mind
  1019. that your players may ask for a much larger world than you were thinking
  1020. of when you designed the game.)
  1021.  
  1022. The terrain constraints help you put the country in a reasonable mix of
  1023. terrain.  For instance, if you want to ensure that your countries include
  1024. some land, but be on the coast rather than inland, then you should say that
  1025. the country must have a minimum of 1 sea cell and 1 land cell.  (In practice,
  1026. the values should be higher, so you don't get small islands being used as
  1027. entire countries and lakes being considered the ocean.)  Keep in mind that
  1028. these constraints may be impossible to satisfy, for instance if a particular
  1029. world does not enough of the sort of terrain that is being required in a
  1030. country.  If the basic placement constraints fail, @i{Xconq} will just pick
  1031. a random location, warn about it, and then leave it up to the players to decide
  1032. whether to play the game ``as it lies''.
  1033. @example
  1034. ;;; Keep countries close together, but not too close.
  1035.  
  1036. (set country-separation-min 20)
  1037. (set country-separation-max 25)
  1038. @end example
  1039.  
  1040. Once @i{Xconq} has decided on locations for each country, it then places
  1041. the initial stock of units.  You define this initial stock via the
  1042. unit properties @code{start-with} and @code{independent-near-start}.
  1043. The @code{start-with} units start out belonging to the side, while the
  1044. @code{independent-near-start} units are independent.  The locations
  1045. of these units are random within @code{country-radius-min} of the
  1046. center, but are weighted according to the table @code{favored-terrain}.
  1047. This table is very important; it is the percent chance that a unit of a given
  1048. type will be placed in terrain of the given type.  100 is guaranteed to work,
  1049. and 0 an absolute prohibition.  Since @code{make-countries}
  1050. tries repeatedly to place each @code{start-with} unit until it succeeds,
  1051. then even terrain with a @code{favored-terrain} value of only 10% will get used
  1052. if there is no other choice, so the table affects the distribution of units
  1053. rather than the number that get placed.  If a starting unit cannot
  1054. be placed on any available terrain, but can be an occupant,
  1055. then @i{Xconq} will attempt to put it inside
  1056. some unit already present.  This is a good way to begin a game with
  1057. aircraft at airports rather than in the air.
  1058.  
  1059. The upshot is that all this
  1060. will do a reasonable layout if the parameters are set reasonably.
  1061. If, however, @code{favored-terrain} is never > 0 for the @code{start-with}
  1062. units and the country terrain,
  1063. but there is some other terrain type for which this would work,
  1064. @i{Xconq} will change the terrain.
  1065. If even that doesn't work, the method will fail [or just complain?].
  1066.  
  1067. This example is from the standard @i{Xconq} game:
  1068. @example
  1069. (set country-radius-min 3)
  1070.  
  1071. (add city start-with 1)
  1072. (add town independent-near-start 5)
  1073.  
  1074. (table favored-terrain 0
  1075.   ((town city) plains 100)
  1076.   (town (desert forest mountains) (20 30 20))
  1077.   )
  1078. @end example
  1079. The net effect is to give each player one city outright and 5 towns nearby.
  1080. Although created independent, these towns can be easily taken over right at the
  1081. beginning of a game, so they are a kind of ``warmup'' (like the
  1082. pushing of pawns at the beginning of a chess game).  The @code{favored-terrain}
  1083. table allows cities to appear only in plains, while giving more options to
  1084. towns, since they can appear in deserts, forests, and mountains.  Even so,
  1085. towns are 5 times more likely to be in plains, which is reasonable.
  1086.  
  1087. The optional last step in country generation is to grow the countries outwards
  1088. from the initial area.  This is basically a simple simulation of the
  1089. historical forces that give countries their variety of shapes.
  1090. The algorithm works by deciding whether to add to the country each cell
  1091. at each distance from the country's center.  The chance depends on the
  1092. terrain type and whether the cell has
  1093. already been given to another country.  Once a cell has been given to the
  1094. country, then the method decides whether to add a sided or independent unit
  1095. to the cell, or whether to change the side of an existing unit.
  1096. Country growth stops when either the absolute maximum radius has been
  1097. reached, or too few cells have been added to the country, whichever comes
  1098. first.
  1099.  
  1100. This example is from one of the variants of the standard game:
  1101.  
  1102. @example
  1103. (game-module "standard"
  1104.   ...
  1105.   (variants
  1106.    ...
  1107.     ("Large Countries" eval
  1108.      (set country-radius-max 100)
  1109.      )
  1110.   ))
  1111. @end example
  1112.  
  1113. The resulting effect is to make all the countries border on each directly.
  1114.  
  1115. @section Generating Names
  1116.  
  1117. [put this with generic text generation?]
  1118.  
  1119. One of @i{Xconq}'s special features is its extensive machinery
  1120. for generating names of things.
  1121. You can generate names for sides, units, and geographical features.
  1122. The possibilities range from a simple list
  1123. of strings up to context-free grammars and arbitrary code modules.
  1124. Naming happens throughout the game, as nameable objects are created, but
  1125. mostly happens during initialization.
  1126.  
  1127. @subsection Grammar Examples
  1128.  
  1129. Here is a very simple grammar:
  1130. @example
  1131. (namer (grammar root 40
  1132.   (root (or 1 (the animal in the thing)))
  1133.   (animal (or cat dog sheep))
  1134.   (thing (or hat umbrella fold))
  1135.   ))
  1136. @end example
  1137. It makes phrases like @code{"the cat in the hat"},
  1138. @code{"the dog in the umbrella"}, and @code{"the sheep in the hat"}.
  1139.  
  1140. This example is more realistic:
  1141. @example
  1142. ;;; German-like place name generator.
  1143.  
  1144. ;;; Conventional combos most common, random syllables rare.
  1145. ;;; Needs more conventional words to combine?
  1146.  
  1147. (namer german-place-names (grammar root 50
  1148.   (root (or 95 (name)
  1149.              5 ("Bad " name)
  1150.              ))
  1151.   (name (or 40 (prefix suffix)
  1152.             20 (both suffix)
  1153.             20 (prefix both)
  1154.              5 (prefix both suffix)
  1155.             10 (syll suffix)
  1156.             10 (prefix syll suffix)
  1157.         ))
  1158.   (prefix (or
  1159.         schwarz blau grun gelb rot roth braun weiss
  1160.         wolf neu alt alten salz hoch uber nieder gross klein
  1161.         west ost nord sud
  1162.         ;; from real names
  1163.         frank dussel chem stras mut
  1164.         ))
  1165.   (suffix (or
  1166.         dorf torf heim holz hof burg stedt haus hausen
  1167.         bruck brueck bach tal thal furt
  1168.         ;; these aren't so great
  1169.         ach ingen nitz
  1170.         ))
  1171.   (both (or
  1172.         feld stadt stein see schwein schloss wasser eisen berg
  1173.         ))
  1174.   ;; Generate random syllables
  1175.   (syll (or 40 (startsyll vowel endsyll) 5 (vowel endsyll)))
  1176.   (startsyll (or 30 startcons 10 startdiph))
  1177.   (startcons (or b k d f g l m n r 5 s 3 t))
  1178.   (startdiph (or bl kl fl gl 5 sl 3 sch 2 schl
  1179.                  br dr kr fr gr 2 schr 3 tr 2 th 2 thr))
  1180.   (vowel (or 6 a ae 2 au 5 e 2 ei 2 ie 6 i 3 o oe 2 u ue))
  1181.   (endsyll (or 4 b 5 l 3 n 4 r 4 t
  1182.                bs ls ns rs ts 3 ch 3 ck
  1183.                lb lck lch lk lz ln lt lth ltz
  1184.                rb rck rch rn rt rth rtz
  1185.                ss sz 2 th tz
  1186.       ))
  1187.   ))
  1188. @end example
  1189. This generator usually takes normal German words and glues a
  1190. couple together, making names like @code{"Schwarzburg"},
  1191. @code{"Nordbruck"}, and @code{"Bad Salzwasser"},
  1192. but it will occasionally make a completely
  1193. random syllable using common German phonemes, then glue it into a name,
  1194. resulting in names like
  1195. @code{"Biefeld"} and @code{"Salzgloelthach"}.  Yes, that last one
  1196. is unpronounceable even for Germans, but the generator doesn't
  1197. know that!
  1198.  
  1199. Since there is no special handling to ensure non-garbled names,
  1200. it generally does not work particularly well to try to build
  1201. names from vowels and consonants.  Either random selection from
  1202. a list or putting together syllables seems to do better, with
  1203. perhaps a single totally random syllable thrown in.  Don't forget
  1204. that this is a generator, not a recognizer or parser,
  1205. so you don't have to be able to handle
  1206. every possible name; just enough to make an interesting variety.
  1207.  
  1208. Recursive rules, where a symbol expands into a
  1209. sequence mentioning that same symbol, will work, but they are not recommended.
  1210. Although the generator has a builtin
  1211. limiter to keep from looping forever,
  1212. and the UGH list is available,  [this is to be changed?]
  1213. in general there is no way to avoid
  1214. getting awful names like @code{"Feldbruckbruckbruck"}.
  1215. Instead, you can just add extra rules, one for each desired length,
  1216. so for instance you have a rule for 2-syllable names, one for 3-syllable
  1217. names, one for 4 syllables, etc.
  1218. Another advantage is that you can set the probability of each 
  1219. length of name separately,
  1220. and thus lower the probability of longer names,
  1221. so that they only appear once in a while
  1222. and you save the poor players from being continuously tongue-tangled!
  1223.  
  1224. @section Altitudes and Elevations
  1225.  
  1226. [where should this section go?]
  1227.  
  1228. @i{Xconq} is basically a 2-dimensional game,
  1229. but you can emulate a third dimension by defining elevations for terrain
  1230. and altitudes for units above and below the terrain.
  1231.  
  1232. The main use of altitudes is to control interactions between certain kinds of
  1233. units, particularly aircraft.
  1234. For instance, a high-altitude bomber should be able to pass over a ship
  1235. and under a satellite with impunity.
  1236. In general, you define the ``operating altitudes" of a unit, so in the
  1237. example above, you could say that a ship is always at the surface,
  1238. bombers operate at 1-10 km, and satellites at 100-10,000 km.
  1239. If a unit has more than one operating level, then it can move up and down
  1240. by normal movement actions.
  1241.  
  1242. Also, most details such as speed and material consumption are the
  1243. same for a unit at any altitude.  (Yes, such things vary in real life,
  1244. but the effects are usually minor within the unit's normal operating
  1245. range.)
  1246.  
  1247. Altitudes also have a significant effect on combat.
  1248. A unit at some altitude can only attack units at a specific range of altitudes
  1249. up and down.
  1250. Using the example again, you could define fighter aircraft to operate at
  1251. 0-20km and be able to attack up and down 5km, while bombers can
  1252. attack up to 10km down (i.e. down to the ground), but not up.
  1253. Satellites remain invulnerable.
  1254.  
  1255. All this applies equally to units underground and undersea.
  1256.  
  1257. @section Tech
  1258.  
  1259. Tech is useful when technological development is important
  1260. to a game.  There are several ways to use it.
  1261.  
  1262. One use of tech is to track the results of research.
  1263. You do this by setting the initial tech of a side to (say) 0,
  1264. then requiring a certain tech (say 60) in order to build a desired type.
  1265. If a research action adds 1 to a side's tech, then it will
  1266. take 60 research actions to gain the necessary level.
  1267. The number of turns will of course depending on how actions
  1268. the researcher can do each turn, and how many researchers
  1269. are available.  So for instance, 10 researching units results
  1270. in the work being done in 6 turns instead.  You can limit this
  1271. schedule acceleration by setting @code{tech-per-turn-max}.
  1272.  
  1273. Another use of tech is to differentiate sides.
  1274. Suppose you want to do a game involving earthlings and space aliens.
  1275. The aliens can have satellites overhead that earthlings don't even
  1276. know are there, they have equipment earthlings couldn't use even if
  1277. they were able to capture it.  However, earth scientists might learn
  1278. something from it.  To do all this, use @code{tech-to-see} and friends.
  1279.  
  1280. Tech is fundamentally tied to unit types.  However, many games have
  1281. a number of unit types that share technology.  For instance, advances
  1282. in bomber technology usually lead to advances in fighter and surveillance
  1283. aircraft.  The @code{tech-crossover} table is available for this purpose.
  1284.  
  1285. @section Static Relationships Between Types
  1286.  
  1287. This section describes the ``static'' relationships between types of
  1288. objects, meaning those relations which must always hold, both in the
  1289. initial setup and throughout a game.
  1290.  
  1291. @subsection Stacking
  1292.  
  1293. By default, @i{Xconq} allows only one unit in each cell at a time.
  1294. This has the advantage of simplicity, but also makes some bizarre
  1295. situations, such as the ability of a merchant ship to prevent an
  1296. airplane from passing overhead or a submarine from passing underneath.
  1297.  
  1298. To fix this, you can allow players to stack several units in the
  1299. same cell.  This is governed by several tables, which give you control
  1300. over which and how many of each type can stack together in which kinds
  1301. of terrain.  The basic idea is that a cell has a certain amount of room
  1302. for units, as specified by the terrain type property @code{capacity},
  1303. and each unit has a certain size in the cell, according to the table
  1304. @code{unit-size-in-terrain}.
  1305.  
  1306. @example
  1307. (add (plains canyons) capacity (10 2))
  1308.  
  1309. (table unit-size-in-terrain
  1310.   ((indians town) plains (1 5))
  1311.   ((indians town) canyons (1 2))
  1312.   )
  1313. @end example
  1314.  
  1315. In this example, a player can fit 10 indians or 2 towns into a plains cell,
  1316. or else one town and 5 indians, while canyons allow only 2 indians or one town.
  1317.  
  1318. In addition, some unit types may be able to count on a terrain type providing
  1319. a guaranteed place; for this, you can use the unit/terrain table
  1320. @code{terrain-capacity-x}.  This table (which defaults to 0) allows
  1321. the specified number of units of each type to be in each type of
  1322. terrain, irrespective of who else is there.  For instance,
  1323. a space station could be given space via
  1324. @example
  1325. (table terrain-capacity-x (space-station t* 10000))
  1326. @end example
  1327. So while units on the ground are piling together and being constrained
  1328. by capacity, space stations overhead can stack together freely (space
  1329. is pretty big, after all).
  1330.  
  1331. @subsection Occupants and Transports
  1332.  
  1333. Occupants and transports work similarly to stacking in terrain;
  1334. there is both a specialized capacity and a generic capacity that
  1335. units' sizes count against.
  1336.  
  1337. @example
  1338. (add (transport carrier) capacity (8 4))
  1339.  
  1340. (table unit-size-as-occupant
  1341.   ((infantry armor) transport (1 2))
  1342.   ((fighter bomber) carrier (1 4))
  1343.   )
  1344.  
  1345. (table unit-capacity-x
  1346.   (carrier fighter 4)
  1347.   )
  1348. @end example
  1349.  
  1350. It may be that all the different sizes interact so that you can't
  1351. prevent huge numbers of small units being able to occupy a single
  1352. transport.  To fix this, use @code{occupants-max}.
  1353.  
  1354. Transport is a physical relationship, so for instance one cannot use
  1355. transports to define a convoy whose acp-per-turn is determined by its
  1356. slowest member.  (This doesn't mean you can't define a convoy
  1357. type, but you will have to pick an arbitrary speed for it.)
  1358.  
  1359. @section Setup Miscellany
  1360.  
  1361. @subsection Self-Units
  1362.  
  1363. Normally a player runs the side as a whole,
  1364. and all the units on that side are disposable and interchangeable.
  1365. However, you require one unit to represent the player personally
  1366. among the units of the player's side;
  1367. this unit is the @dfn{self-unit}.
  1368. What this means is that if that unit is captured or dies,
  1369. the player loses the game instantly.
  1370. All the other units on the side will behave normally as for losing,
  1371. either going over to the side that captured the player,
  1372. becoming independent, or disbanding.
  1373.  
  1374. The idea is to increase the player's motivation for self-preservation.
  1375. This is useful to introduce a risk of capture, assassination, and so forth.
  1376. It also prevents bizarre and unrealistic strategies in some games.
  1377.  
  1378. For instance, it sometimes happens in empire-building games that players
  1379. end up switching countries, because each captured another's country and
  1380. neglected to defend their own.  If each player got one capital city,
  1381. and that city were to be a self-unit, then the owner would have to defend
  1382. it at all costs!
  1383.  
  1384. To make this happen, you could do something like this:
  1385. @example
  1386. (set self-unit-required true)
  1387.  
  1388. (add capital-city can-be-self true)
  1389.  
  1390. (add capital-city start-with 1)
  1391. @end example
  1392.  
  1393. @section Units and Actions
  1394.  
  1395. Players can do all kinds of things with their units.  They can push
  1396. the units around, they can make units build things, they can get into fights,
  1397. or they can just let them sit around.
  1398. You as the designer decide which kinds of things make sense in your
  1399. game, then set up the action parameters appropriately.
  1400. Is moving through swamps going to be slow?
  1401. Can a small town build any kind of ship, or just small ones?
  1402. How often can Godzilla breathe fire?
  1403.  
  1404. Now, what the players work with is the interface, which can do all
  1405. kinds of intelligent things -- whatever makes sense for that interface.
  1406. However, no matter what the interface, no matter what kind of play
  1407. automation, player input eventually breaks down into unit actions.
  1408. The set of action types is predefined and can't be changed.
  1409. They are also very primitive.  Each action takes a number of arguments,
  1410. such as the type of unit to build or the location to move to,
  1411. the action just happens and either succeeds or fails on the spot.
  1412. There are no actions that take longer than one turn to complete,
  1413. and a unit can perform only one action at a time.
  1414. This may seem horribly restrictive, but actions are just
  1415. the low-level building blocks;  players rarely see actions directly.
  1416. You have to be aware of them because the game design specifies
  1417. which unit types are capable of which actions.
  1418. Each @i{Xconq} interface will adjust itself to disallow input that
  1419. would result in types of actions that you have prohibited.
  1420.  
  1421. The number of actions that a unit can do in one turn is limited
  1422. by its action points.  A unit with zero action points cannot do anything
  1423. at all.  A unit with lots of action points can do lots of actions,
  1424. unless each action costs many action points.
  1425. You can define the action point cost of each type of action for each
  1426. unit type.  In some cases, the cost will also depend on the action's arguments.
  1427.  
  1428. Acp is actually a little like a bank account,
  1429. since by not doing anything for awhile,
  1430. a unit can accumulate extra acp (up to @code{acp-max}),
  1431. and it can go into debt temporarily, down to @code{acp-min}
  1432. (which may be a negative value).
  1433. A unit in ``action debt'' at the beginning of a turn cannot move
  1434. or do anything else, and must for a turn
  1435. when its acp goes positive again.  This can be a simple way to implement
  1436. both fatigued units and units that can do more if they plan for it.
  1437.  
  1438. Actions intrinsically both an actor and an ``actee''.  The actor is
  1439. the brains, and that is whose acp gets used up, but the actee has the
  1440. action actually happen to it.  This is so animate units (like humans)
  1441. can work with inanimate units (like swords).
  1442.  
  1443. @section Movement
  1444.  
  1445. Movement is the most important action type.  There are actually two distinct
  1446. types of actions; one to enter a cell, and one to enter a unit.
  1447.  
  1448. Each unit has a speed which is determined at the beginning of the turn
  1449. and determines how many cells it can enter during the turn.
  1450. However, terrain, borders, and other obstacles can consume extra
  1451. movement points.
  1452.  
  1453. @subsection Unit Speed
  1454.  
  1455. Units have a base speed @code{speed} which is the ratio of mp to acp.
  1456. You can set damaged units to move more slowly.
  1457. You can also allow occupants to add to the speed, up to the
  1458. @code{speed-max} limit.
  1459.  
  1460. @subsection Movement Costs
  1461.  
  1462. Typically the cell entry cost will be the most useful to adjust,
  1463. although the departure cost can be useful in representing units
  1464. mired in jungle mud
  1465. and taking a long time to escape onto clear terrain.
  1466.  
  1467. Be aware that complicated entry/exit costs are confusing to players,
  1468. and AIs may not take them into account very well either.
  1469. Using @code{free-mp} helps players use up all their acp.
  1470.  
  1471. @subsection Entering Transports
  1472.  
  1473. Different kinds of transports have different ways for units
  1474. to get on and off.  For instance,
  1475. ships can dock, or use their boats to enable land units to get on and off.
  1476. The tables @code{ferry-on-entry} and @code{ferry-on-departure}
  1477. specify how much terrain units will have to cross on their own.
  1478.  
  1479. [example]
  1480.  
  1481. Observe that enter/leave costs can be used to make one-way trips.
  1482. For instance, paratroops jumping out of a plane should be able
  1483. to leave cheaply, but have an entry cost so high that they can
  1484. only reboard in a later turn.
  1485.  
  1486. @subsection Border Slides
  1487.  
  1488. One of the problems with @i{Xconq} borders and connections is that
  1489. neither works exactly like a sea strait.  Consider the Straits of
  1490. Gibraltar.  They are so narrow that one can see the other side,
  1491. but nevertheless impose a formidable barrier to landlubbers.
  1492. At the same time, ships can pass through readily, if
  1493. not secretly.  If cells in the world are 60 miles across, then
  1494. making an all-sea cell is a gross exaggeration.
  1495. However, adding a water border only prevents both land and sea movement!
  1496. To get around all this, @i{Xconq} allows a special kind of
  1497. move called a ``border slide''.
  1498. Basically, if both the destination cell and the border whose endpoints
  1499. touch the start and end cells are allowable terrain for a unit,
  1500. then the unit can move to the destination cell in one move.
  1501. However, it incurs a special cost in addition to the normal entry
  1502. and leave costs for the terrain in the two cells (but @i{not} the border
  1503. crossing cost, since the border is not being crossed, exactly).
  1504. This cost is in the table @code{mp-to-traverse}.
  1505. Border sliding should usually be somewhat expensive, both because
  1506. of the distance (the unit ends up two cells away after only one move),
  1507. and because of the real-life difficulties of passing through a narrow
  1508. strait.  Note that border sliding does not escape the units on either
  1509. side of the border, since the unit doing the sliding will still be
  1510. adjacent to the cells on each side of the border it slid through.
  1511.  
  1512. @subsection Leaving the Area
  1513.  
  1514. This feature can be useful in allowing a non-disbandable unit type
  1515. to escape capture or otherwise retire from action.
  1516.  
  1517. @subsection Free Moves
  1518.  
  1519. This is most useful in emulating some board games,
  1520. or to prevent clever players from exploiting a mess of move costs.
  1521. The default of @code{-1} is the most playable,
  1522. since player will always be able to use all of their mp.
  1523. Otherwise, there may be situations in which a unit has
  1524. a few acp left, but not enough to go anywhere,
  1525. and so they end up being wasted.
  1526. The free move does not actually get subtracted from the unit's acp.
  1527.  
  1528. @subsection Zone of Control
  1529.  
  1530. Sometimes a unit can by its presence alone affect the movement of unfriendly
  1531. units in the vicinity, perhaps by requiring them to hide or to move
  1532. carefully in order to pass by, or even to prevent entry altogether.
  1533. This is called the ``zone of control'' or ZOC.
  1534.  
  1535. Exerting a ZOC requires no action, nor any particular capability on
  1536. on the part of the unit exerting the ZOC.  For instance, a toothless
  1537. fort could still cause raiders to sneak by carefully (at least if they
  1538. didn't know that it was toothless).
  1539.  
  1540. @section Construction
  1541.  
  1542. Construction is very important to empire-building and similar strategic
  1543. games.  The construction of a unit may involve as many as four different
  1544. kinds of actions.  This is so you can make construction be an expensive
  1545. long-term process.
  1546.  
  1547. The basic construction is unit creation.  A player might have to do
  1548. research and toolup actions in order to prepare for creation, and might
  1549. also have to do completion actions, if the created unit is not ready to use.
  1550.  
  1551. Normally the interface will just have a single "Build <type>" command,
  1552. which then results in a task that issues appropriate actions, so players
  1553. don't necessarily see all these different actions.
  1554.  
  1555. @subsection Research
  1556.  
  1557. Some types of units may be relatively easy to build, once you know how,
  1558. but at the same time that type totally changes the balance of the game.
  1559. The atomic bomb in WWII is the classic example; once it became available,
  1560. everything changed.
  1561.  
  1562. To allow research, set @code{acp-to-research} to 1 or more.
  1563.  
  1564. [see Section xxx for more description of tech levels]
  1565.  
  1566. @subsection Tooling Up
  1567.  
  1568. Toolup costs are what you use to represent the overhead of changing
  1569. construction.  Quite often it does not need to be set.  Its primary
  1570. use is to encourage players to commit to grand strategy once chosen,
  1571. because the cost of changing would be prohibitive.
  1572.  
  1573. @subsection Creation
  1574.  
  1575. Players can create a unit either inside another unit, or out in the open.
  1576. The acp cost is that same in either case.
  1577.  
  1578. @subsection Completion
  1579.  
  1580. By default, newly-created units are complete and ready-to-use.  This is
  1581. rarely a good idea in a game design, since 1-acp unit can then create
  1582. another unit on each turn.  If you're going to allow that, then you
  1583. should include something else keep players from being swamped by
  1584. overpopulation.  You can set high accident or attrition rates, make
  1585. creation require scarce materials, only have one or a few of the creator
  1586. type.
  1587.  
  1588. The best way to slow down unit creation is to create incomplete
  1589. units and then require build actions.  Completeness is defined
  1590. in terms of completeness points or cp that you can define for each
  1591. type.  A completion action just adds to completeness points.
  1592. Incomplete units do in fact exist as units, so for instance they
  1593. can be captured and completed by another side.
  1594.  
  1595. You can set separation and build acp so that several units can
  1596. cooperate to accelerate construction of a unit.
  1597. There are no maximum rate limits set on this, but it's
  1598. unlikely that players will ever be able to achieve much
  1599. acceleration, because of the limit on the separation between
  1600. the builder and the unit.  For instance, the default separation
  1601. of zero implies that multiple builders of a unit have to be in
  1602. the same cell.
  1603.  
  1604. @section Combat
  1605.  
  1606. Not all games require fighting.  Races and exploration
  1607. can be lots of fun, and not need players to be bashing each other.
  1608. However, the excitement of most @i{Xconq} games derives
  1609. from the chances of going up directly against an opponent.
  1610.  
  1611. Combat includes five distinct action types that a player may choose
  1612. from, not counting detonation, and you specify the characteristics
  1613. of each.  ``Attack'' is hand-to-hand with another unit, ``capture''
  1614. attempts to change the side without damaging, ``fire-at'' hits a unit
  1615. without getting entangled, while ``fire-into'' hits everything
  1616. in a targeted cell.
  1617. Finally, ``overrun'' is an attempt to occupy a cell, doing whatever
  1618. combination of attack, capture, and movement is necessary.
  1619.  
  1620. To specify what kinds of battles are possible, you begin by setting
  1621. the @code{hit-chance} of some unit vs another unit to any value
  1622. greater than zero.  A hit probability of zero completely disallows
  1623. attack.  A hit probability of 100 is a guaranteed hit.
  1624. In practice, you will probably need to specify most hit probabilities
  1625. individually.
  1626.  
  1627. [describe mods to hit prob?]
  1628.  
  1629. Next you need to set the damage done by a hit.
  1630. The default value is 1 hp, which is a good starting place
  1631. but not always particularly realistic.
  1632.  
  1633. [describe variation parms]
  1634.  
  1635. As usual, you can define the action point cost of combat.
  1636. The attacker and defender use separate tables, which allows for
  1637. some extra flexibility.  This is important, because sometimes you
  1638. want to allow combat to keep a defender busy and soak up its acp,
  1639. while at other times attempts to engage in combat should be shrugged off.
  1640. Consider battleships vs infantry; although combat between the two
  1641. rarely causes much damage, an attack by a battleship will cause the
  1642. infantry to keep their heads down, and preventing them from doing much else,
  1643. while the return rifle fire is unlikely to keep the battleship
  1644. from making its appointed rounds.)
  1645.  
  1646. Describing simple hit probabilities and damage is oftentimes sufficient
  1647. for a game.  It's simple; players can learn the numbers by heart.
  1648. It's more efficient, because there's no need to manage lots of
  1649. ongoing battles.  However, there are endless numbers of situations
  1650. where this basic model is unsatisfactory, so let's move on to the
  1651. available enhancements.
  1652.  
  1653. The basic parameter for the firing actions is @code{range} of the unit,
  1654. which is the greatest reach possible.
  1655. You can also set a @code{range-min}, which is useful for ballistic
  1656. missiles, certain kinds of artillery,
  1657. and magic spells that can't used for close-in fighting;
  1658. you can't fire at a unit that is less than @code{range-min} cells away.
  1659.  
  1660. Also, you can define how transports and occupants affect each other in
  1661. combat.  The effects can be both positive and negative, and extend both
  1662. from occupants to their transport and from the transport to its occupants.
  1663. The table @code{transport-protection} defines the percentage of hit damage
  1664. (by any unit type) that gets passed through to each occupant.
  1665. If 0, then the transport is perfect protection. If 100, then each occupant
  1666. gets the same hit as the transport did.
  1667. [Ideally, protection is a prorating on table value from occupant vs attacking
  1668. unit.]
  1669. Note that an occupant cannot be attacked directly from outside its transport.
  1670.  
  1671. If you want to make combat dependent on having a supply of ammo, use the
  1672. tables @code{hits-with} and @code{hit-by}.
  1673. The material type need not be explicitly designated as ammo,
  1674. but both the hitting and hit units must agree that the same type
  1675. is effectual (we assume that the attacking unit is smart enough not to
  1676. use material types that have no effect on the target unit).
  1677.  
  1678. [need a combat-supply usage in addition]
  1679.  
  1680. @subsection Multi-Round Battles
  1681.  
  1682. By default, combat actions are basically raids;
  1683. one strike and it's all over.
  1684. This of course is highly unrealistic, and leads players to
  1685. engage in combat far more casually than is realistic.
  1686.  
  1687. You make combat more involving by defining commitments to battles.
  1688. Basically, units attack by raising their commitment from zero up to some
  1689. values, and remain in combat until they die, are captured, or withdraw
  1690. by reducing their commitment to zero again.  At the start of each round,
  1691. each unit that is participating has the choice of raising or lowering its
  1692. commitment to the battle, within bounds that you define.
  1693.  
  1694. Note that units in battle don't have to attack, but that they are
  1695. prevented from doing other things.  This can be useful not only
  1696. for field battles, but sieges (cities have to deal with besiegers),
  1697. and wrestling matches.
  1698.  
  1699. @subsection Capture
  1700.  
  1701. [say something about garrisoning rules]
  1702.  
  1703. @subsection Detonation
  1704.  
  1705. Detonation is an action type that represents a variety of explosive
  1706. behaviors.  It can be requested explicitly by the side, or happen
  1707. automatically.
  1708.  
  1709. A minefield could be implemented by defining a detonating unit that
  1710. loses some small percentage of its hp every time a unit hits it,
  1711. while hitting the other unit automatically.
  1712.  
  1713. A simple trap would auto-detonate only once, then change to
  1714. a ``sprung trap'' type.
  1715. Then the right kind of unit could come along and do a change type
  1716. action to reset it.
  1717.  
  1718. @section Unit Manipulation
  1719.  
  1720. The actions in this group are a mixed bag of manipulations.
  1721. If they need to be in your game, then the need will be obvious,
  1722. otherwise they are pretty much optional.
  1723.  
  1724. @subsection Moving Unit Parts
  1725.  
  1726. Any unit whose @code{parts-max} is greater than the default of 1
  1727. is a multi-part unit, and its hp denotes size rather than amount
  1728. of damage.  Armies and fleets are two kinds of units which can
  1729. be usefully defined as multi-part.
  1730.  
  1731. Players will very often want to merge or detach parts of a multi-part
  1732. unit, and there is an action provided for that.
  1733. You can control the cost of the action by setting @code{acp-to-move-part}.
  1734.  
  1735. @subsection Changing Side
  1736.  
  1737. @subsection Changing Type
  1738.  
  1739. @subsection Disbanding
  1740.  
  1741. Sometimes a player will want to get rid of a unit,
  1742. perhaps because some type has been overproduced and is tying up
  1743. valuable resources, or to prevent it from falling into enemy hands.
  1744.  
  1745. You can control this via @code{acp-to-disband}.
  1746.  
  1747. It should usually not be possible to disband something large like a city,
  1748. otherwise a clever player might try to eliminate it as a strategic target,
  1749. but most mobile units should be easily disbanded.
  1750.  
  1751. @section Material Manipulation
  1752.  
  1753. You can allow players to produce materials by explicit action,
  1754. and you can control how they transfer materials between units.
  1755.  
  1756. Note that you can usually have a reasonable game without requiring
  1757. all the players to become shipping clerks.  The automated production
  1758. and transfer parameters (see xxx) are almost always sufficient for
  1759. a game.  Explicit action should be limited to games where material
  1760. limitations are so severe that they impact strategy directly,
  1761. and players have to make hard choices between producing materials
  1762. and doing other actions, on a turn-by-turn basis.
  1763.  
  1764. You can define ``stevedore'' units by setting both rate and acp such that
  1765. the u1 -> stevedore -> u2 transfer is faster and cheaper
  1766. than the basic u1 -> u2 rate.
  1767. Then players can use the stevedores to speed up transfers.
  1768.  
  1769. @section Terrain Manipulation
  1770.  
  1771. In a few games, you will want to let players alter the terrain.
  1772. This needs to be done judiciously,
  1773. since a cell of terrain generally represents a vast area,
  1774. and the simulated time in @i{Xconq} is generally too short
  1775. for major terraforming operations.
  1776. However, building bridges and digging moats can be reasonable
  1777. additions to a game.
  1778.  
  1779. Since actions are always completed quickly,
  1780. and there is no concept of ``partly modified terrain'',
  1781. you will probably have to come up with a trick to make terrain modification
  1782. be slow.  One way is make the acp (or material?) cost very high.
  1783. Another way is to make the alteration happen by removing a material,
  1784. such as clearcutting a forest.
  1785.  
  1786. @section Vision
  1787.  
  1788. Vision is an important part of @i{Xconq}.
  1789. Information need not come for free in your game design,
  1790. and you can design the parameters to control how much players can get.
  1791. The possibilities range from total knowledge as in board games,
  1792. where nothing is secret except the enemy's heart,
  1793. to games where much of the play hinges on who knows what, and when.
  1794.  
  1795. @subsection Seeing All
  1796.  
  1797. The simplest thing to do is to set @code{see-all} to @code{true}.
  1798. Then every player sees all the terrain, everybody's units, everybody's
  1799. occupants, the whole world and everything in it.
  1800. This makes @i{Xconq} like a conventional video or board game,
  1801. which is sometimes just what you want.
  1802. Also, since the view matches the world, the game is simpler for players,
  1803. who need not concern themselves with possibly out-of-date information.
  1804. Finally, @code{see-all} is more efficient in time and space,
  1805. since the general visibility calculations need never be done or recorded.
  1806. Many games include @code{see-all} as one of their variants.
  1807.  
  1808. You may also find @code{see-all} to be a useful game debugging aid,
  1809. since you can watch what is happening everywhere in the world.
  1810. Just remember that any AIs will most likely employ a different
  1811. strategy, and that you won't be able to debug the other viewing
  1812. parameters!
  1813.  
  1814. @subsection Coverage
  1815.  
  1816. Still, much of the fun in @i{Xconq} is the potential for surprise.
  1817. The theory of visibility in @i{Xconq} is that each side has one or
  1818. two layers of coverage, one for generic vision and one for specialized
  1819. sensors, each of which basically just counts the eyeballs looking at
  1820. each cell.  As your units move around, the coverage in each cell
  1821. goes up and down.
  1822. Any cell with a coverage of zero is not currently being viewed
  1823. by any of the player's units.
  1824.  
  1825. The unit property @code{see-always} is useful for units like towns,
  1826. which are unlikely to disappear secretly.
  1827.  
  1828. These two parameters apply recursively, so for instance a city could be
  1829. @code{see-always} and @code{see-occupants},
  1830. while a building in the city is @code{see-always} and not
  1831. @code{see-occupants}, with the net effect that units
  1832. inside a city can be seen by everybody,
  1833. but not when they enter a building.
  1834.  
  1835. @code{already-seen} should usually be true of things like cities,
  1836. independently of their @code{see-always} setting.
  1837.  
  1838. @subsection Initial View
  1839.  
  1840. The initial view represents the knowledge assumed to have been
  1841. gathered over the period of time preceding the game.
  1842. @i{Xconq} lets you set a radius around each initial unit,
  1843. within which the side knows everything.
  1844. Also, any people on your side view both their cell and all
  1845. the adjacent cells.
  1846.  
  1847. @subsection Vision Range
  1848.  
  1849. The default vision range is 1, which basically means that units
  1850. can see into adjacent cells but no further.  Ranges > 1 make sense
  1851. for tactical- and person-level games (especially when combined
  1852. with LOS rules if they ever get implemented).
  1853.  
  1854. You can also set the vision range of a unit to 0, which means that
  1855. it can only see things in its own cell.  However, as a special
  1856. case, when such a unit enters a new cell, @i{Xconq} will show the
  1857. terrain of each adjacent cell, but not any units that might be
  1858. present.  This is so players
  1859. can decide which way to move without having to plunge blindly into
  1860. unknown terrain or do some sort of awkward ``adjacent cell examination''
  1861. action before moving.
  1862.  
  1863. @section Backdrop Weather
  1864.  
  1865. [The four temperature extremes are independent of each other,
  1866. so you can make higher latitude temperatures vary drastically with the
  1867. season, while equatorial temperatures are much more stable; or vice versa.
  1868.  
  1869. Average temperature usually varies more slowly over some kinds of terrain
  1870. than others.  For instance, oceanic circulation moderates temperature
  1871. swings in terrain that is near open ocean.]
  1872.  
  1873. @section Backdrop Economy
  1874.  
  1875. Economy in @i{Xconq} means pushing materials around.  So if you want an
  1876. economy in your game design, you have to define at least one type of
  1877. material.  To define the economy, you have to decide where materials
  1878. come from, how they get moved around, and how they get used up.
  1879.  
  1880. @subsection Creating Materials
  1881.  
  1882. Materials come into existence either by placed in units or terrain
  1883. during setup, by being produced by units or terrain, and by appearing
  1884. in newly-created units.
  1885.  
  1886. @subsection Moving Materials
  1887.  
  1888. Once in existence, players can move materials around by explicit action.
  1889. You can also define automated material movement that uses supply and demand.
  1890. The tables @code{in-length} and @code{out-length} control the distance
  1891. over which materials will move each turn.
  1892.  
  1893. @subsection Consuming Materials
  1894.  
  1895. Materials exist to be consumed (unless they are relevant to a scorekeeper).
  1896. You can set how much each kind of action uses, as well as how much is needed
  1897. as a prerequisite, sort of like a catalyst.  You can also set consumption
  1898. due to existence alone, plus what happens to a unit when it supply of a
  1899. material runs out.
  1900.  
  1901. [note role of money as a special material type]
  1902.  
  1903. @section Random Events
  1904.  
  1905. What simulation game would be complete without random events?
  1906. Random events are handled somewhat similarly to synthesis methods,
  1907. in that you set the value of the variable @code{random-events}
  1908. to a list of the methods that you want run.
  1909.  
  1910. Superficially, random events just introduce some unpredictability
  1911. into a game.  However, adding it just for its own sake is not
  1912. a good idea; in the worst case, the game becomes the infamous
  1913. ``dice-rolling contest'', where nothing matters except luck.
  1914. Random events are more valuable when they introduce risk,
  1915. and players have to balance that risk against their goals.
  1916. As an example, random losses of cities in the standard game
  1917. would be pointless, since players have to have them, and there
  1918. would be a chance that all of a player's cities would disappear,
  1919. causing the player to lose for no good reason at all.
  1920. On the other hand, the chance of losing an expensive capital
  1921. ship in shallow coastal waters is enough to motivate the player
  1922. to keep them well out to sea.
  1923.  
  1924. @subsection Accidents
  1925.  
  1926. Accidents should be restricted to definite hazardous situations, to go along
  1927. with movement constraints - for instance, carriers and battleships
  1928. in shallow water should have a small chance to hit a rock and sink.
  1929.  
  1930. You can specify two kinds of accident; a damaging accident,
  1931. which hits the unit as if it were in combat, or a vanishing
  1932. accident, in which the unit disapppears instantly.
  1933.  
  1934. @subsection Attrition
  1935.  
  1936. Attrition is a sort of higher-probability/lower-damage type
  1937. of accident.  It is useful for armies in hostile terrain,
  1938. where deserters and casualties slowly reduce its strength.
  1939.  
  1940. Attrition can be useful for ``aging''
  1941. a unit, if you need to keep the unit from being around too long.
  1942.  
  1943. @subsection Revolts
  1944.  
  1945. Revolts are spontaneous changes of side, independent of any
  1946. other consideration.  Since there is no way to protect against
  1947. this, the chance should usually be very small, less than .01;
  1948. even a small chance of will cause players to maintain reserves
  1949. just in case.
  1950.  
  1951. @subsection Surrenders
  1952.  
  1953. @section Designing the Interface
  1954.  
  1955. So far, the game design machinery has been focused on semantics.
  1956. The other part of the game design defines how it actually appears
  1957. to the players.  This part of the design can be more loosely
  1958. designed, which is good, because you cannot guarantee that your
  1959. game design will only ever be run with a particular interface,
  1960. and there is a wide variety of interfaces.  You could, for instance,
  1961. define an elaborate set of color graphical icons and patterns,
  1962. only to find that most of your players only have black-and-white
  1963. displays.  @i{Xconq} itself will always be able to cope with
  1964. your omissions, but it will be forced to synthesize
  1965. inferior substitutes.
  1966.  
  1967. Game designs have three general categories of interface elements
  1968. that they can specify: text, graphics, and animations.
  1969. Text elements are just strings describing objects and events
  1970. in a readable, while the graphics consists of small icons
  1971. and patterns primarily representing units and terrain.
  1972. Animations are used to illustrate events as they happen,
  1973. and may include sounds.
  1974.  
  1975. @section Designing Text
  1976.  
  1977. Although @i{Xconq} is primarily a graphical game system,
  1978. it is complex enough that the graphics alone are
  1979. insufficient to describe what is going on.
  1980.  
  1981. All text that players see is issued by @dfn{text generators},
  1982. which are objects that, when given appropriate inputs,
  1983. produce text fragments that can be used by the interface
  1984. to produce a textual display.
  1985. Each text generator has a number of parameters that
  1986. may be used to select one of several rules [etc]
  1987.  
  1988. @subsection Describing Objects
  1989.  
  1990. [units, sides, etc]
  1991.  
  1992. [should be able to have multiple descriptions for each type of object]
  1993.  
  1994. @subsection Describing Events
  1995.  
  1996. [should be able to have multiple descriptions for each type of event]
  1997.  
  1998. @section Designing the Graphics
  1999.  
  2000. @i{Xconq} is fundamentally a graphical game;
  2001. fortunately, you don't have to do gnarly
  2002. graphics hacking to get the pretty pictures!
  2003. The basic graphics handling is built into the interface
  2004. subroutines of @i{Xconq}.
  2005. What you @i{do} have to do is to choose or design the basic images.
  2006.  
  2007. @i{Xconq} will always attempt to generate
  2008. some sort of default display for your new game design, but it's
  2009. likely to be pretty ugly.  So your goal here is just to make the
  2010. display look good.  First off you should decide about the overall
  2011. appearance.  Do you want things to be generally light or dark?
  2012. Garish or subtle?  Conventional or exotic?  This is a good time
  2013. to cruise the image libraries and to look at the graphics of other
  2014. games.  Sometimes the theme decides a lot for you - how could you
  2015. display anything than a red star on a Soviet tank?  You also need
  2016. to think about whether you want to concentrate on b/w or color displays,
  2017. although again @i{Xconq} will try to do something reasonable for both.
  2018.  
  2019. You have to choose three sets of images: terrain patterns or images,
  2020. unit icons, and side emblems.  The terrain patterns have to tile properly,
  2021. since they may be used to fill in large areas, while both unit icons
  2022. and side emblems are single icons.  You can optionally choose solid
  2023. colors for terrain, and to ``colorize'' unit icons and side emblems.
  2024.  
  2025. Once you chosen and specified a set of images, you have to try them
  2026. out in various combinations in real games.  What you'll most likely
  2027. discover is that they don't always mix like you imagined.  That
  2028. cool-looking emblem for a side disappears against the background of
  2029. space, or two unit icons are nearly indistinguishable on the map.
  2030. At this point, you have to start making some tough choices.
  2031. Either substitute some different images, or design new ones of your
  2032. own.
  2033.  
  2034. Color choices are tricky.  Again, the total effect can be quite different
  2035. from what you imagined, plus you should be careful about the variety
  2036. of displays that your game runs on, or you may be getting complaints
  2037. about how your ``olive'' more closely resembles ``puke gray''!
  2038.  
  2039. Here is an example of unit icons:
  2040. @example
  2041. (add (infantry town city) image-name ("soldiers" "town20" "city20"))
  2042. @end example
  2043. In general, icon names describe the appearance of the image, and so
  2044. do not necessarily match up directly with type names.  The @code{"soldiers"}
  2045. icon, for instance, just shows a row of soldiers; in one game the icon
  2046. can be used to infantry, in another, armies in general, and in another, the
  2047. national guard.  There is in fact an @code{"infantry"} image also,
  2048. but it is the standard ``crossed bandoliers'' symbol favored by the
  2049. US Army, and is really only sensible for games involving US Army infantry.
  2050.  
  2051. [example of terrain patterns and colors]
  2052.  
  2053. For extra fine control on color displays,
  2054. you can also set the colors of unseen terrain
  2055. and the grid separating cells, via the globals @code{grid-color}
  2056. and @code{unseen-color}.
  2057.  
  2058. Note that some display systems (such as the X Window System)
  2059. allow users to customize
  2060. most or all of their colors, so individuals may override your choices.
  2061. Not much you can do about that though!
  2062.  
  2063. @subsection Image Format
  2064.  
  2065. [describe when fleshed out]
  2066.  
  2067. @subsection Image Design Hints
  2068.  
  2069. The design of each graphical image can and should be somewhat independent
  2070. of the basic game design;
  2071. this allows for reuse of pictures.
  2072.  
  2073. The first thing you should do is to check the image library on your
  2074. machine.  The image you're looking may already be there, but perhaps
  2075. under a different name.  Even if you don't find it, you may notice
  2076. an image that is close enough to be a good starting point.
  2077. The @i{Xconq} image library presently includes hundreds of images,
  2078. so the chances are pretty good that you'll find something useful.
  2079.  
  2080. Designing good images and patterns is a specialized and demanding category
  2081. of artwork that I'm not going to go into here.
  2082. My best advice is to learn from the pros,
  2083. and don't be afraid to experiment.
  2084.  
  2085. @section Game Module Organization
  2086.  
  2087. Each separate file is known as a @dfn{game module} or just @dfn{module}.
  2088. A module has a name, displayed name, an advertising-style blurb, a version,
  2089. and designer notes.
  2090.  
  2091. This is an example of an elaborately-declared game module with no
  2092. actual content:
  2093. @example
  2094. (game-module "foobar"
  2095.   (title "Foo of Bar")
  2096.   (blurb "An exciting game with lots of cliffhanging suspense")
  2097.   (version "1.3")
  2098.   (program-version (>= "7.0.3"))
  2099.   ;; other properties?
  2100.   (complete-game true)
  2101. )
  2102.  
  2103. ;;; contents here
  2104.  
  2105. (game-module (notes (
  2106.   "This is just a sample game."
  2107.   ""
  2108.   "It's not really as interesting as the blurb makes out."
  2109.   )))
  2110.  
  2111. (game-module (design-notes (
  2112.   "This is commentary addressed to other designers."
  2113.   "Also a good place to mention things to work on."
  2114.   )))
  2115. @end example
  2116. The @code{notes} and @code{design-notes} could have been supplied with the
  2117. first @code{game-module} declaration, but in practice, putting the
  2118. player and designer notes at the end of the file
  2119. keeps them out of the way.
  2120. You can supply any number of @code{game-module} declarations in a file.
  2121. Only the first need include a name.
  2122.  
  2123. The game module format is only loosely structured.
  2124. In general, anything that you might want to reuse or combine
  2125. in different ways should be a separate module.
  2126. Good candidates include text generators and maps of real terrain.
  2127. Unfortunately, they don't always mix-and-match as well as you
  2128. might like!
  2129.  
  2130. @section General Techniques
  2131.  
  2132. There are at least three ways to make a new game design:
  2133. use @i{Xconq} commands to ``play'' a game and then save it,
  2134. create and text-edit the text files defining a game,
  2135. or write and run special-purpose programs
  2136. that create games.  A combination of these techniques will likely prove
  2137. the most useful, since each alone has both strengths and weaknesses.
  2138. For instance, text editing may seem like a crude approach,
  2139. but is the only way to produce certain types of scenarios,
  2140. and text editors have many facilities
  2141. (such as regular expression replacement)
  2142. not directly available in @i{Xconq}.
  2143. On the other hand, maintenance of the correct
  2144. transport/occupant relationships between units
  2145. is hard to do while editing text,
  2146. but comes for free when using @i{Xconq} itself.
  2147.  
  2148. @node Building Scenarios, Language, General Techniques, Game Design
  2149.  
  2150. @section Building Scenarios
  2151.  
  2152. The easiest way to customize @i{Xconq} is to build a scenario.
  2153. A scenario is basically a saved game from which irrelevant details,
  2154. such as the list of players, has been omitted.  Typically
  2155. this will include tweaking details, removing random irrelevant junk,
  2156. and generally tuning things.
  2157.  
  2158. One way to do this would just be to start a normal game, save it, and
  2159. then dig through the saved game and edit it, since the saved game is itself
  2160. a game module.  Sometimes this is easy, more likely it will be quite hard
  2161. and error-prone.  A better way is available, in the form of ``designer mode''.
  2162.  
  2163. @subsection Designer Mode
  2164.  
  2165. There are two way to get into designer mode;  one is to start up a game
  2166. with the appropriate option (@code{-B} under Unix), which makes
  2167. every player with a display a designer, the other is to
  2168. switch on a flag after the game has started.
  2169. Being a designer is a property of a side,
  2170. so in theory a game could have a designer and several other human players,
  2171. or even multiple designers (this might be useful in having assistants to
  2172. help with the construction of large scenarios, or just to have displays
  2173. open to each side's view of the scenario).  AIs effectively sit out the
  2174. game while designers are present.
  2175.  
  2176. Designer mode enables an additional set of commands on the menu or map
  2177. control panel, as well as removing some restrictions on the use of
  2178. normal commands.  It also enables more elaborate game saving machinery,
  2179. so you can save only the parts of a game that you want to make into a scenario.
  2180.  
  2181. Modifications to normal commands include the permission to look at and
  2182. do any command on any unit, including independents and units belonging
  2183. to other sides.
  2184. For instance, any unit can be renamed at any time by any designer in the game.
  2185. The modications include the following:
  2186.  
  2187. @itemize @bullet
  2188. @item
  2189. Move commands can put any unit at any destination instantly.
  2190.  
  2191. @item
  2192. Any unit can be put on any side.
  2193.  
  2194. @item
  2195. Any unit can be disbanded instantly.
  2196.  
  2197. @item
  2198. Any terrain can changed to any type.
  2199. @end itemize
  2200.  
  2201. Some interfaces may also provide additional tool palettes and the like.
  2202.  
  2203. @subsection Saving Scenarios
  2204.  
  2205. If you're not in designer mode, then saving the game will save absolutely
  2206. everything.
  2207. In designer mode, the interface should ask you what parts of the game you
  2208. want to save, and what to name the module.
  2209.  
  2210. If you don't save everything, then you should start up another game
  2211. just to confirm that you got what you wanted, @i{before} shutting down the
  2212. @i{Xconq} that you're designing with.
  2213. Sometimes you won't have saved what you thought you did...
  2214. It's also a good idea to keep a backup copy of data,
  2215. especially the indecipherable area layers;
  2216. use the nesting comments @code{ #| |# } around the old stuff,
  2217. only delete when you're sure it's no longer of interest.
  2218.  
  2219. @section Preparing a Game for Use
  2220.  
  2221. Once you've constructed a game, you should bring it to a state where it
  2222. can be given to other @i{Xconq} players.  The process is like that for
  2223. any other sort of software.
  2224. Fortunately, @i{Xconq} game designs are usually smaller
  2225. than C programs, so the usual software release problems
  2226. are minimal.  A version number is recommended, preferably
  2227. a distinct number for each time you change it.
  2228.  
  2229. @subsection Installing Scenarios
  2230.  
  2231. Once the scenario is constructed and saved, you can install it in the library
  2232. and otherwise do as you like with it.
  2233. See the specific interface documents for installation details.
  2234.  
  2235. @subsection Safety
  2236.  
  2237. While generally safe -- @i{Xconq} shouldn't crash while you are designing
  2238. nor upon starting up your scenario -- you can do silly things,
  2239. like loading a submarine with battleships as passengers.
  2240. @i{Xconq} won't complain, but it may behave very strangely.
  2241. For instance, a unit might be able to travel with a transport and leave it,
  2242. but not be able to get back on again.
  2243.  
  2244. One way to test a game is to remove all the scorekeepers and
  2245. make all the players be AI-controlled.  The AI code will then
  2246. act totally randomly and thus exercise parts of your design
  2247. that you may not have thought about.
  2248.  
  2249. @subsection Balance and Playtesting
  2250.  
  2251. More importantly, scenario design can involve
  2252. subtle questions of balance, which
  2253. can only revealed by repeated play of the scenario.  Playtesting is
  2254. extremely important, even for simple scenarios!  You should try as many
  2255. combinations of startup options as possible - for instance, the combo
  2256. of two humans and one machine might reveal a peculiarity that is not
  2257. observed in a two-person game.
  2258. You can solve many problems by adding more restrictions.
  2259. Since the scenario is your concept, you are free to make whatever
  2260. decisions are necessary to realize that concept;  if somebody
  2261. complains, they are free to make their own designs.
  2262.  
  2263. Playtesting is also the time when you may have to sacrifice realism
  2264. and favorite theories for playability.  Listen to and watch yourself and your
  2265. testers as the game is played.  For instance, you might have included a city
  2266. out in the boonies, but in the game it never does anybody much good, while
  2267. still requiring some amount of attention regularly.  Lose it.
  2268.  
  2269. Game startup can be confusing to players if they all start out with
  2270. lots of units needing to be told what to do.
  2271. One solution is to put most unit on automatic behaviors that expire
  2272. in a turn or two, so that novices gradually hear from all the units,
  2273. while experts can still override right from the outset.
  2274. Another approach is to make units independent and allow them to be
  2275. captured early on.
  2276. Still another approach is to make units come in as reinforcements
  2277. at preset times and locations.
  2278.  
  2279. Although as many of the game parameters as possible are checked,
  2280. there is plenty of room for subtle loopholes.  You should think carefully
  2281. about the consequences of each parameter, being particularly sensitive to
  2282. degenerate winning strategies.  Most common are units that are too powerful,
  2283. too fast,
  2284. or are built so quickly that they overwhelm any opposition.
  2285. Players should always be a little ``hungry'';
  2286. not able to get quite as many
  2287. units or as much material as they would really like.
  2288.  
  2289. @subsection Complexity
  2290.  
  2291. Although GDL is a powerful language,
  2292. you should avoid designing a game that is too complex to be humanly playable.
  2293. A single game can literally define
  2294. millions of different numbers, each with a range including 100 to 10,000 
  2295. distinct values.  It is clearly possible to spend many
  2296. years exploring just a single set of these numbers.  For more playable and
  2297. enjoyable games, either pick a single things to treat in detail, or else
  2298. do everything in a simplified way.
  2299. For instance, if you want elaborate movement and combat rules,
  2300. avoid or even eliminate materials and associated material handling rules.
  2301. Another thing to
  2302. keep in mind is that the introduction of a new type may have far-reaching
  2303. consequences - a new unit type will need its interactions with @i{all}
  2304. other unit types defined.  One approach is to introduce a new type as a
  2305. slight modification of an existing type, then to share most of the
  2306. definitions.
  2307. Another thing you can do is to put complexity into the variants,
  2308. so players with a taste for punishment can indulge themselves
  2309. without making everybody else suffer.
  2310.  
  2311. @subsection Combinations
  2312.  
  2313. Many of the 700-odd game parameters were
  2314. chosen for their ability to combine in interesting ways,
  2315. rather than for obvious usefulness.
  2316. For instance, construction in a city can by default
  2317. generate an infinite stream of units.
  2318. But suppose you want to put a limit on the numbers of that type of unit?
  2319. One way is to define a material that
  2320. is essential for construction of that type, let the builder have an initial
  2321. supply, but provide no way to get more of that material.  When it runs out,
  2322. no more units!
  2323.  
  2324. Another trick is to motivate an activity by making it a
  2325. prerequisite to the basic builtin goal of defeating the other player.
  2326. The age of discovery worked this way.  The kings of that time weren't
  2327. interested in new lands per se;  they wanted exploitable possessions that
  2328. could be used to get gold to buy armies big enough to defeat their neighbors.
  2329. You could describe this situation almost exactly, by making
  2330. gold a material, obtainable only by the discovery and capture of independent
  2331. gold mine units, which are thinly scattered over the world
  2332. and can be found only by careful exploration.
  2333.  
  2334. Be inventive!
  2335. Studying the predefined games should suggest many tricks;
  2336. the ``Problems and Solutions'' section below describes
  2337. even more.
  2338. Be sure to document the trick carefully, or the next time you
  2339. work on the game, you might break it and will have unhappy
  2340. players wondering why their usual strategies don't work anymore.
  2341.  
  2342. @node Debugging, Examples, Combining Parameters, Design Hints
  2343.  
  2344. @section Debugging
  2345.  
  2346. Completely new game designs usually have a number of bugs.
  2347. There are several stages of trouble that you may encounter.
  2348. First, the @i{Xconq} may fail to read a game module completely.
  2349. It will try to report what happened, but if for instance you
  2350. left out a closing parenthesis, you may get some strange error
  2351. messages.  This is just plain old syntax error trouble.
  2352.  
  2353. Once you've successfuly read in your new game,
  2354. bring up the online help and scan through to see if the values
  2355. present are what you thought.
  2356. Sometimes the reader does not interpret a module in the way
  2357. you thought it would.
  2358. The @code{print} form is useful for debugging at this point;
  2359. it can show you whether a defined symbol has the value you
  2360. thought it did.
  2361.  
  2362. However, the most serious
  2363. problems with games are play balance issues.  Some can be found out by
  2364. watching a machine player attached to a display,
  2365. since its decisions are based on perceived values of the units.
  2366. The most subtle bugs can only be uncovered by extensive play
  2367. interspersed with judicious alteration of parameters.
  2368. I find it useful to play for a while,
  2369. then review and adjust the game parameters all at once,
  2370. thus avoiding tweaking one parameter only to find that it results in
  2371. another being inconsistent.
  2372. Parameters interact in many ways - you should keep this in
  2373. mind when experimenting.
  2374.  
  2375. Something else to keep in mind at this point is that playability should
  2376. outweigh realism.  For example, real-life airplanes can travel 1,000
  2377. times faster than a person walking on the ground, but airplanes that
  2378. could move 1,000 cells in a turn would be ridiculous
  2379. (try it out, @i{Xconq} WILL let you do this!).
  2380.  
  2381. @section Problems and Solutions
  2382.  
  2383. This section discusses specific kinds of design problems and ways that
  2384. you might solve them in @i{Xconq}.  These are merely suggestions;
  2385. in the past, game designers have come up all sorts of ingenious ideas.
  2386. If you come up with one yourself, please pass it along!
  2387.  
  2388. @subsection Limiting Unit Quantities
  2389.  
  2390. In some cases you may want to constrain the total number of units in play,
  2391. perhaps because of performance reasons, or because some type tends to
  2392. proliferate more than is desirable, or because your game concept requires
  2393. a hard limit on the number of units.  You have several ways to do this.
  2394.  
  2395. @i{Xconq} does give you several parameters
  2396. that put a simple cap on total numbers, either by unit type or for all
  2397. units, and per side or for all sides together.
  2398. You can also define a material type that is essential to the creation,
  2399. completion, or operation of units, and make that material be hard to come by.
  2400. Iron to make ships, gold to pay armies, or food to feed armies could all
  2401. work this way.  If the only source of the limiting material is an initial
  2402. supply in a starting unit, then this is a hard limit; if production of the
  2403. limiting material is slow, then the limit is softer but still very real.
  2404.  
  2405. Limits on unit quantities have some interesting uses beyond the obvious ones.
  2406. For instance, a
  2407. useful type that is limited to at most a single instance could be a sort of
  2408. ``football'' where the side that has the one unit finds itself being
  2409. chased after by all the other sides trying to get it.
  2410. You could make a WWII-era game with
  2411. ``Oppenheimer'' as the only scientist who knows how to make
  2412. an atomic bomb (I know, it's not realistic), and have the different sides
  2413. trying to kidnap him.
  2414.  
  2415. @subsection Handicapping
  2416.  
  2417. Very rarely will the @i{Xconq} players in a game all be at the same skill
  2418. level.  Sometimes this is OK, since weaker players really do learn more
  2419. from their losses than their wins.  However, when the goal is to have fun,
  2420. or when the difference in abilities is extreme, you can balance things out
  2421. in several different ways.
  2422.  
  2423. One simple approach is just to design an imbalanced scenario, document
  2424. it as such, and let players choose the stronger and weaker sides as desired.
  2425. In many cases this should be sufficient; for instance, accurate historical
  2426. simulations.
  2427.  
  2428. The next most simple solution is to set up sides or side classes and
  2429. fill random properties differently.  Weaker players could choose a side with
  2430. more technology or whose class allows more powerful units.  This isn't
  2431. very adjustable, since all the sides and their property values
  2432. have to be predefined.
  2433.  
  2434. To enable the most precise match of player abilities, you can use the
  2435. @code{initial-advantage} property of player objects.  This property is
  2436. a relative value, defaulting to 1, and indicates how strong the initial
  2437. unit setup should be relative to the other players.  For instance,
  2438. if a three-player game includes advantages of 2/3/7, then the second player
  2439. will have three units for each two of the first player while the third
  2440. player (the weakest) will have seven.  The implementation of relative
  2441. advantages is up to game synthesis, so for example the @code{make-countries}
  2442. will adjust all the numbers of initial units to match the requested
  2443. advantages.  Note that this affects only the initial setup, and only
  2444. certain synthesis methods.
  2445. Once a game has started, all sides are always on an equal footing.
  2446.  
  2447. @subsection Buying the Initial Setup
  2448.  
  2449. A common form of game setup is to give each player a quantity of ``money''
  2450. of some sort, then give them a menu from which to buy things.  The way you
  2451. would implement this in @i{Xconq} is similar to the method for limiting
  2452. unit quantities - make the money be an initial supply of a special material
  2453. type not used for any other purpose.  This initial supply should be given
  2454. to a first unit that each player starts with.  This first unit could be
  2455. something like the adventurer in a fantasy game who starts with a pot of money,
  2456. so the first unit is also the most important one,
  2457. or perhaps a little dummy unit that
  2458. buys the other units and then is of little interest thereafter, sort of like
  2459. the national bank for the player's country.
  2460.  
  2461. Here's an example:
  2462. @example
  2463. (unit-type adventurer
  2464.   (start-with 1)
  2465. )
  2466. (unit-type shop
  2467.   (start-with 1)
  2468. )
  2469.  
  2470. (unit-type sword)
  2471. (unit-type armor)
  2472. (unit-type boat)
  2473.  
  2474. (material-type money)
  2475.  
  2476. (table initial-supply (adventurer money 200))
  2477.  
  2478. (table acp-to-create (shop (sword armor boat) 1))
  2479.  
  2480. (table material-to-create ((sword armor boat) money (20 100 1000)))
  2481. @end example
  2482. The shop can't do anything besides create items when given money.
  2483. The adventurer starts with the money and has to give it to his/her shop,
  2484. then order the shop to create the
  2485. items desired.  The shop will create completed items instantly,
  2486. ready for the adventurer to use.
  2487.  
  2488. Note that this can't be extended to buy extra intrinsic qualities,
  2489. such as hit points or action points.
  2490.  
  2491. @subsection Leaders
  2492.  
  2493. Some games, particularly wargames set in Napoleonic times or earlier,
  2494. feature the concept of a ``leader'' as the sole individual who can make
  2495. things happen.  Without a general or field marshal, the army won't move.
  2496.  
  2497. One way to do this is to make the leader be a self-unit and limit the
  2498. distance of direct control over other unit types.
  2499.  
  2500. Another way is give armies 0 acp and allow leaders to push them around.
  2501.  
  2502. Another way is to use leaders as occupants that add to armies' mp.
  2503.  
  2504. @subsection Navigable Rivers
  2505.  
  2506. The concept of a navigable unbridged river is a real problem for @i{Xconq}.
  2507. Non-navigable rivers are easily done as border terrain,
  2508. and navigable rivers with lots of bridges can be connections
  2509. (since by their nature, connections can never prevent movement).
  2510. But a navigable river that can't be crossed easily is more of a problem.
  2511. One way is to make a chain of adjacent cells of a water terrain type.
  2512. However, this can be quite unrealistic if cells represent large areas,
  2513. say 10-100 km across; you can end up with continents consisting of more
  2514. river than land.  In some cases, you can define a ``river valley''
  2515. terrain type where both vessels and ground units can exist, with the
  2516. river border terrain along just one edge of the valley.
  2517.  
  2518. You can also allow border sliding.  Border sliding allows a ship to pass
  2519. along the length of a border, but it does require the ship to be in
  2520. compatible terrain at both ends of the border.  So define the river
  2521. as a chain of alternating water cells and water borders connecting them
  2522. together.  Then the river acts as a barrier to units wanting to cross,
  2523. while allowing them to see over to the other side,
  2524. and at the same time ships can pass up and down the river freely
  2525. (modulo any ZOC exerted by units on either side).
  2526.  
  2527. @subsection What Ranges for Values?
  2528.  
  2529. One of the problems that you encounter when defining a lot of interrelated
  2530. units with lots of properties and tables
  2531. is to decide where to start out with the numbers.
  2532. There are a couple ways to get started.
  2533.  
  2534. First, you can start from real-world numbers.  Let's say your game concept
  2535. is based on turns that last about one day, and you want to use worlds
  2536. with cells that are about 10 miles across.  Now a person in good shape
  2537. can walk about 2 miles per hour, or 20 miles in a day, which comes out
  2538. to 2 cells/turn as @code{acp-per-turn} for units on foot.  This allows
  2539. a speed of 1 cell/turn for injured, tired, or overburdened persons, via
  2540. the various speed modifiers.  However, if this same game includes
  2541. automobiles and airplanes, then using the same calculation,
  2542. we get automobiles that can move 60 cells/turn and airplanes that can
  2543. move 600 cells/turn!  The massive disparity in speeds makes for poor
  2544. playing; every turn each airplane will make 300 moves while the foot
  2545. traveller makes 1.  To make the game work, you'd have to make airplanes
  2546. slower (they have to refuel a lot perhaps) or make people faster (nobody
  2547. walks anywhere anymore).  So the real-world numbers approach isn't
  2548. foolproof.
  2549.  
  2550. Another way to go is to start with the smallest values and work up.
  2551. For instance, in the monster game above, you could assume that the mob moves
  2552. the slowest, and give it a speed of 1.  Then you say that the national
  2553. guard should be able to move twice as fast, and give it a speed of 2.
  2554. Then the monster should be able to chase and catch mobs and guards
  2555. that run away, so you give it a speed of 3 or more.  This approach
  2556. is more painstaking, particularly when lots of numbers are involved.
  2557.  
  2558. You can use both approaches together as well, working with real-world
  2559. numbers until they get too weird, then adjust to make relative values
  2560. sensible, then do some more real-world calculations.
  2561. As always, only playtesting is the final arbiter.
  2562. Once the numbers ``feel'' right in a game,
  2563. only the obsessive-compulsives will care about their exact values.
  2564.  
  2565. @subsection Fatigue
  2566.  
  2567. Players are often unmerciful to their units, moving them nonstop,
  2568. going into battle after battle, never a thought for how tired the
  2569. poor units might be.
  2570. Although @i{Xconq} does not include fatigue as a basic concept, it does
  2571. have several ways to implement the effects of fatigue.
  2572.  
  2573. One way is to use acp debt.  If you allow the acp to go negative during a turn,
  2574. then the player can work the unit really hard for one turn, then it has to
  2575. rest until its acp builds up to positive levels again.  While acp is negative,
  2576. the unit can take no action on its own.  Over a period of
  2577. time, the effect is that of a unit that can only do so much,
  2578. but can exert itself when needed.
  2579.  
  2580. Another way to do fatigue is via a material type, perhaps called
  2581. ``energy'' or ``enthusiasm''.  As an abstract sort of material,
  2582. don't let energy be passed around (unless you want to have ``infectious
  2583. enthusiasm'', might be useful sometimes for leaders and morale builders).
  2584. Units need energy in order to move, and can consume energy faster
  2585. than they produce.  For instance, if a unit has a speed of 3 hexes/turn,
  2586. consumes 2 units of energy per move, and only produces 4 units of energy
  2587. each turn, then on the average the unit will only be able to move 2 hexes
  2588. in each turn, although if it saves up energy, then it can move the full
  2589. 3 hexes.
  2590. Since different kinds of terrain can have differing productivity,
  2591. you can also make some kinds of terrain be more tiring than others.
  2592. A resort hotel unit could also be allowed to transfer energy to its
  2593. residents, restoring them faster than a Motel 6.
  2594.  
  2595. @subsection Brainless Units and Scorekeeping
  2596.  
  2597. One special case to watch out for occurs in games with ``unintelligent''
  2598. units, that is, they have an acp of 0.  If a side loses all of its units
  2599. except for the unintelligent ones, the player will not be able to do
  2600. anything except wait for the game to end.
  2601. This might be OK, for instance if the idea of the game allows
  2602. for a side to own a particular unit, whether or not it can do anything
  2603. with it (perhaps the unit is a fort, and a side can win if it owns the
  2604. fort, even at the cost of all its other units).  Usually, however, the
  2605. side ought to just lose, in which case you will need to define a special
  2606. scorekeeper that requires each side to have at least one of some
  2607. sort of unit with acp > 0, or else it loses.
  2608.  
  2609. @subsection Days and Years
  2610.  
  2611. [should go elsewhere]
  2612.  
  2613. The @i{Xconq} world can be made to revolve around its sun and to rotate
  2614. on its axis. [etc]
  2615.  
  2616. To get a realistic hour-by-hour simulation, say
  2617. @example
  2618. (world
  2619.   (day-length 24)
  2620.   (year-length 8766) ; this is 365.25 days
  2621.   )
  2622. @end example
  2623.  
  2624. @subsection Xconq 5.x SetProduct
  2625.  
  2626. @i{Xconq} version 5 had a sometimes-useful flag called ``setproduct''
  2627. that could be set to false, with the effect that any attempts to
  2628. *change* construction were disabled.  So for instance, a city that
  2629. was set by a scenario to build bombers would then build bombers
  2630. throughout the game.  The advantages were both in realism (retooling
  2631. a factory can be very time-consuming) and in playability (no construction
  2632. planning required).
  2633.  
  2634. To emulate this in version 7, you can set @code{acp-to-toolup}
  2635. to be zero for cities, but at the same time require 1 tp for each
  2636. type that the city can construct.  In the scenario, set the value
  2637. of the city's tooling to be 1 for the one or more types that you
  2638. want it to specialize in (maybe switching between fighters and
  2639. bombers should be possible, but not to submarines).
  2640. Players can then start and stop construction as desired,
  2641. but are limited to only particular types.
  2642. Even captured independent cities can be limited in what they
  2643. can be used to construct.
  2644.  
  2645. @section Optimization
  2646.  
  2647. The @code{add} form is very powerful and very useful for making
  2648. groups of objects share some data.  The grouping also helps the
  2649. designer to see how sets of numbers compare to each other.
  2650. In other words, instead of having multiple forms:
  2651. @example
  2652. (unit-type foo
  2653.   ...
  2654.   (acp-per-turn 3)
  2655.   ...)
  2656. (unit-type bar
  2657.   ...
  2658.   (acp-per-turn 49)
  2659.   ...)
  2660. (unit-type baz
  2661.   ...
  2662.   (acp-per-turn 2)
  2663.   ...)
  2664. @end example
  2665. you can say
  2666. @example
  2667. (add (foo bar baz) acp-per-turn (3 49 2))
  2668. @end example
  2669. to get the same effect.
  2670.  
  2671. To get an inheritance-like effect, you can append lists of types
  2672. together, as in
  2673. @example
  2674. (define mammal (dog cat cow))
  2675. (define bird (hawk eagle condor))
  2676. (define animal (append mammal bird fishie))
  2677. @end example
  2678. which results in a list of seven types.  It is possible to append
  2679. different kinds of objects together.
  2680.  
  2681. @subsection Preferred Module Names
  2682.  
  2683. Terrain-only modules should be @code{t-xxx}.
  2684.  
  2685. Lists of units should be @code{u-xxx}.
  2686.  
  2687. Name generators should be @code{ng-xxx}.
  2688.  
  2689. @section Junk to Describe Better
  2690.  
  2691. An unwanted unit in a shared lib file
  2692. could be gotten rid of by matching on id or
  2693. name and then setting hp to 0 - (unit "Corinth" (hp 0)) for instance.
  2694.  
  2695. [this doesn't actually work]
  2696. Elevation data, while interesting to include, can take up a lot of space
  2697. and be more detailed than necessary.  The parameters here allow you to
  2698. restrict elevations to a smaller range of values, which will allow
  2699. for more compact encoding and simpler games.
  2700. For instance, a game set in rolling countryside doesn't need a huge
  2701. range of elevations; you could set elevations to range from 0 to 300
  2702. meters, in 30-meter increments.  Then only 4 bits will be needed to
  2703. encode each value, and yet the player will still see reasonable values
  2704. like "150 meters", and formulas for temperature and other elevation
  2705. dependent data will be correct.
  2706.  
  2707. Note that just because a player controls a side doesn't mean that the
  2708. controlled side can be taken out of the game; for one thing, certain
  2709. types of units will not change sides under any circumstances.
  2710.  
  2711. People materials should usually not be directly movable
  2712. between units.
  2713.  
  2714. ZOC should be < combat range usually, means that exerter should be able to
  2715. control ground (but could attack further in multiple turns).
  2716. ZOC levels only those reachable by the unit.
  2717.  
  2718. With all the costs of moving around,
  2719. it may be that a unit has movement points left, but
  2720. not enough to meet the full cost of a desired move action.
  2721. You can allow player extra movement points to complete the action
  2722. by setting @code{free-mp} to effectively add the needed mp.
  2723.  
  2724. A hit on a complete unit should reduce by whole cp/hp, otherwise
  2725. will appear to be incomplete.  @i{Xconq} will not fix this,
  2726. you have to arrange all the numbers yourself, or run the risk
  2727. of player confusion.
  2728.  
  2729. You can define wind-affected units by defining speed in each direction
  2730. (max-speed only, do others proportionally).  Would need 4 distinct mp costs
  2731. plus a formula to relate to wind strength.  Wind speed defined as "how
  2732. far a particle of air moves in a turn".  Unit examples include balloons,
  2733. sailing ships, floating cities.
  2734.